This site uses tracking cookies. By using this site, you agree to our Privacy Policy. If you don't opt in, some parts of the site might not function.
Blog
Home / Blog / FileMaker / How to Build a Dynamic FileMaker Navigation Bar
17Oct 2017

How to Build a Dynamic FileMaker Navigation Bar

About the Author

Mike Duncan Mike Duncan

Mike is an AWS Certified Solutions Architect as well as a certified FileMaker Developer. In addition to his work, Mike also enjoys pursuing his art, freelance writing, traveling, and spending time with his family.

Comments (15)

Nuri Özbilenler - November 5, 2017

Hello there
Thank you so much. it makes a lot of work

Best regards

Reply
Baran - November 14, 2017

Hello Mike,

Is it correct that I cannot access the scripts in the sample file and also cannot modify the layout?

Kind regards,

Baran

Reply
    Mike Duncan
    Mike Duncan - November 14, 2017

    Hi Baran,

    The sample file is completely open, so you can examine all code and make changes if needed.

    Mike

Caroline - February 12, 2018

This solution is excellent! It saves me a ton of time!

The one problem I have run into, is that if my secondary button has multiple words in it, that section is not shown as active unless you click on it a second time. For example, in your sample file, if you change the layout name from “Company__Details” to “Company__Company Details”, that segment no longer shows as active when you click on it once. If you click that same segment a second time, it then shows the segment as active. It is interesting, as it does not seem to be a problem with the primary or tertiary bars.

Any help would be greatly appreciated.

Thank you!
Caroline

Reply
    Mike Duncan
    Mike Duncan - February 16, 2018

    Hi Caroline,
    I was able to replicate the issue on my end. Seems to have been an oversight, as I was handling spaces in the third tier, but not the second. I just added that support as well and updated in my GitHub repository. You can download a new copy from there. All you will need is the updated first tier and copy/paste that in your solution, as none of the scripting or anything else changed. The “Active” state of all tiers is evaluated in the top most button bar.
    Thanks
    Mike

Katy - August 2, 2018

Hi, I have been unable to disable line 30 and enable line 32 in the Load Nav script and still get the secondary and tertiary tiers to load. Once I make this change the bottom two tiers do not appear to load. I was hoping to set names (that are not layout names) and then handle them as exceptions. I can only assume I am not doing something correctly?

Reply
    Mike Duncan
    Mike Duncan - August 11, 2018

    Hi Katy,
    Are you using the same delimiter to indicate tiers? The default delimiter is two underscores, and is something that can be modified on line 21 of the Load Nav script. You would then handle the exceptions in the Nav ( layout ) script.

Bruce - August 14, 2018

Hi, Great tool and explanation.

Just one note:
To install I also had to copy the CF’s: USER_ABORT_SETTING, #ParameterToVariables, and #t over into my solution.

Thanks!

Reply
Katy - August 15, 2018

Hi Mike, yes I have $this.layouts set to:
“Home” & “¶” &
“Home__Dashboard” & “¶” &
“Home__Reports” & “¶” &
“Home__Reports__Additional” & “¶” &
“Company” & “¶” &
“Company__Details” & “¶” &
“Company__Contacts__Info” & “¶” &
“Company__Contacts__One” & “¶” &
“Company__Contacts__Two” & “¶” &
“Prefs”
I have not changed what was provided in the sample. If you swap out lines 30 and 32 and re-run the Load Nav Script it will appear to have worked but the minute you close the file and then re-open it then the second tier does not show. I have spent a couple of hours with the dubugger but had no luck spotting the problem. I have a solution with over 800 layouts and it needs new nav put through and I really like this concept but I cannot rename the layouts so am hoping to use the alternative of setting names and using the exceptions.
Thank you for replying. I am sure this is a busy time for you.

Reply
Katy - August 15, 2018

From what I can work out today there is a disconnect between the calculation for ActiveSegmentCalc on button bar where it is setting the .PRIMARY.ACTIVE to the LayoutName and then when the button hide and name calculation try and evaluate “$$NAV.” & $the.win & “.PRIMARY.ACTIVE” ) ; ” ” ; “_” ) it is not working as the PRIMARY.ACTIVE is not evaluating. Just have not worked out how to get around this when you are not using the actual layout names. Have to say this is pretty impressive. I was not even aware you could specify a calculation for Active Segment! Sorry that I cannot quite work this one through.

Reply
Katy - August 15, 2018

Hi Mike, I have this working but am pretty sure there is a more elegant fix. I have amended the ActiveSegmentCalc to use a global variable for $this.layout rather than get(LayoutName) and then I have added something into the Nav (layout) script to set this variable. I now also need to run this script on first window open and have had to put a “Refresh Window” after any Go to Layout (specific cases/exceptions) script steps in Nav (layout) script for the active button underline to refresh to correct position. So feels like although I have got this working there was probably a much better change that would have achieved the same thing. I look forward to hearing from you. I really like the way the nav remembers what level you were on and am hoping to implement with a table that contains records with button label, navigation script to run and parameters to pass to nav script. I already had the table set up when trying to implement another nav solution but I like the tiers in your solution so am hoping to mash them.Thank you for sharing. P.S Fine if you want to delete any of my posts if they are taking up to much space on the page and swap them out for something more succinct! Can’t wait to kick myself when I see the simpler fix you suggest. 🙂

Reply
    Mike Duncan
    Mike Duncan - August 16, 2018

    Hi Katy,
    I will have look into it more, since my solution still relies on the layout name being set to match the variables being set, even if you put overrides in place.

Katy - August 28, 2018

Hi Mike, I have nearly finished implementing the new navigation in our solution. I hit a small but significant issue where all the go to related buttons in portals are currently single script steps and moving between layouts via these did not update the navigation tiers. I have turned about 80 of them into Perform Scripts now but have at least that amount again to go. One thing I just need to query with you is if you know why [1] does not evaluate, all others do like [2], [3], [4] but not [1]? Is it something internal to FM that makes it not evaluate? I just ask because a couple of places like the hide and specify calc’s on Tier 1 and the hide on Tier 2 have [1] included but this value never appears in the data viewer? I have learnt so much from your solution so thank you again for sharing.

Reply
    Mike Duncan
    Mike Duncan - August 29, 2018

    Hi Katy,
    Note sure I quite understand, but the main calculation that sets global variables is in the active button calculation on the top button bar. You might also want to change the z order of those objects so the evaluate correctly top to bottom. I found that z order matters but also within the layout part, so header part at the top will evaluate first, then body and footer, for example. Does that help?

Leave a Reply