Dynamic Menu works by storing the names of the layouts in a global repeating field, and then displaying the numeric instance of the repeating field to generate a series of buttons with titles that match the layout names.  Clicking the button passes the contents of the field repetition to a script as a parameter.  The scripts reads the parameter and goes to the corresponding layout by calculation.

The heart of Dynamic Menu is a script that runs at login to determine what layout names to populate in the repeating menu field.  The layout names that populate the menu names field are filtered by a couple of conditions.  a) does the current user’s privilege set allow them access to the layout.  b) does the name of the layout begin with special characters that prevent it from populating the layout menu.

Let’s get started.

If you don’t already have a table in your FileMaker database for storing system wide data such as preferences, you’ll need to make one.  I like to use the table name “sys” or “prefs”.  In the example I use the table name “!menu” and it contains fields only for managing the dynamic menu.

The menu table contains several fields, but the critical one is “menu”.  It is a global text field with storage options to allow up to 60 repetitions.  The reason that is is global is so that the menu names can be displayed on any layout regardless of the layout’s table.  The reason it is a repeating field with up to 60 occurrences is so that you can have up to 60 layout navigation buttons.  You can have as few or as many as you like.

Now build the display of your menu.  Make a layout called “~menu”.  The tilde will hide the menu layout from the menu.  You’ll see how when we study the login script that filters layout names. Place the “menu” field on your “~menu” layout and use the field format command or inspector (FM11) to show repetitions 1 to 1.  Duplicate the field and move it below the first field and format it to show repetition 2 to 2.  What you are doing is creating buttons that will be titled automatically from the layout names.  You’re using a repeating field so that you don’t have to create fields for every layout name. Repeat these steps until you have a grid of fields organized in order of the field repetitions.  You can align the fields vertically in a single column, multiple columns, or horizontally (as in the header style menu shown in the video).  Just be sure your field repetitions are sequential or else the menu order won’t match the layout order.

I’ll finish this solution tutorial Oct 22-23.