Database Reference
In-Depth Information
Applying a Script Trigger
The script was nice, and the button improved things, but you're still not done learning how
useful and intuitive scripts can be. Since the point of going to the List layout is to quickly
scan a list so you can find a particular Lease Agreement record, it'd be even more convenient
if the list just knew to sort itself every time you switch to the layout. And that kind of thing is
what Script Triggers are for.
You've just seen that you can run a script from the Scripts menu or from a button. But you
can also tell a script to run when you do other things, like enter data in a field or go to a spe-
cific layout. Here's how to make the “Sort by Last Name” script run every time you go to the
Lease Agreement List layout:
1. On the Lease Agreement List layout, switch to Layout mode and then choose
Layouts Layout Setup .
You'll learn about this dialog box's other options in Chapter 7 . For now, you're inter-
ested in the Script Triggers tab.
2. Click the Script Triggers tab .
The Script Triggers tab appears ( Figure 4-23 ).
3. Select the OnLayoutEnter option in the Event list. Windows users may need to
scroll the list to see that option .
Selecting an Event tells FileMaker when to run a script. Once you make a selection,
the Specify Script window appears.
4. Click the “Sort by Last Name” script to select it and then click OK .
The Script Trigger tab is now set up. Notice that you're letting the script run only
while you're viewing the layout in Browse mode.
5. Click OK .
The script will run each time you switch to the Lease Agreement List layout.
To test the script trigger, switch to Browse mode and unsort your list and then switch to the
Lease Agreement layout. Then switch back to the Lease Agreement List layout. The script
runs and sorts your list for you.
Search WWH ::




Custom Search