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:

  • Theoriginal layout option causes FileMaker to switch to the layout your user was on when the script started. After all, you can run lots of scripts anywhere, especially if they're on the Script menu. Since scripts often change layouts as they run, this option makes sure folks end up back where they started.
  • The Layout Name by calculation option lets you specify a typical FileMaker calculation. The result of the calculation must be text, and it should match the name of one of the layouts in the database. When the script runs, FileMaker evaluates the calculation and switches to the layout with the correct name.
  • The Layout Number by calculation option is similar. You specify a calculation with a number result. FileMaker numbers every layout sequentially, in the order in which they're listed in Layout mode. The result of the calculation determines which layout to visit by number.

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.

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, 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.

Part I: Introduction to FileMaker Pro

Your First Database

Organizing and Editing Records

Building a New Database

Part II: Layout Basics

Layout Basics

Creating Layouts

Advanced Layouts and Reports

Part III: Multiple Tables and Relationships

Multiple Tables and Relationships

Advanced Relationship Techniques

Part IV: Calculations

Introduction to Calculations

Calculations and Data Types

Advanced Calculations

Extending Calculations

Part V: Scripting

Scripting Basics

Script Steps

Advanced Scripting

Part VI: Security and Integration


Exporting and Importing

Sharing Your Database

Developer Utilities

Part VII: Appendixes

Appendix A. Getting Help

FileMaker Pro 8. The Missing Manual
FileMaker Pro 8: The Missing Manual
ISBN: 0596005792
EAN: 2147483647
Year: 2004
Pages: 176

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net