Go to Layout

The Go to Layout script step was introduced on Section 13.1.3. Its purpose is simple: Change layouts. It works just like making a choice from the Layout pop-up menu in the status area, except that the script can go to any layout (even if it doesn't show in the menu).

Go to Layout has just one option, a pop-up menu labeled Specify. In addition to every layout in your database, this menu also has three special choices:


Note: Layout numbers don't necessarily correspond to their position in the Layout pop-up menu. Remember that not all layouts show in this list and you can reorder them manually. To find out a layout's number reliably, switch to Layout mode first. Then go to the layout and look at the Layout box in the status area. It shows which layout number you're on.


See the box below to learn when to use Go to Layout with Layout Name and when to use Layout Number.

FREQUENTLY ASKED QUESTION

Specifying a Layout

There are three ways to tell the Go to Layout step which layout to visit. Which one should I use?

The easiest way is to choose the layout from the Specify pop-up menu (Section 6.2.4). When the script runs, FileMaker goes to your chosen layout, period. (That is, unless somebody deletes the layout.)

The other two optionsspecifying a layout by name or numberare trickier, for a couple of reasons. First, they're a pain: You have to write a calculation when you could just pick from a menu. Second, both calculation methods have soft underbellies. If you specify a layout name using a calculation, and later rename the layout, the script can't find the layout anymore. If you use the layout number, and then add or delete a layout, or rearrange your layout list (Section 5.3.5.5), the script goes to the wrong layout.

On the other hand, these options give you greater flexibility. For example, if you use Go to Layout and specify by Layout Name, you can use script parameters to name any layout in your database. With this technique, you can create a single navigation script and use it in all sorts of routine database tasks.

If you want to create a scripted process that's like a wizard or assistant in some programs, the Layout Number's a god-send. Create the layouts that control your process, and make one Next button that you copy onto each layout. The button gets a Go to Layout script step, specifying a Layout Number that's one more than the current layout number (Get(LayoutNumber) + 1). Now, no matter how you rearrange the layouts, the button always takes your user to the next one in the Set Layout Order listand you've used only one script step.

Категории