Database Reference
In-Depth Information
Chapter 11. Understanding Scripts
When you created the Lease Agreement database in Chapter 3 and Chapter 4 , you wrote a
script to sort records viewed in a list ( Creating a Sort Script ). That script didn't do anything
you couldn't have done manually. But since it remembers a sorting setup, the script is faster
to run than if you have to go to the Sort window and configure it every time you want to scan
the list. To make it even more convenient, you attached the script to a button that your users
could click to sort data without the need to understand how to set up a Sort window. For even
more automation, you gave the list layout a script trigger that ran the Sort script every time
that layout is viewed. It's almost like your database knows what your users need before they
do.
That basic script introduced you to many of the advantages of scripting. Here are the main
reasons to add scripts to your database:
Efficiency . For just about any process, a script can run faster than you (or your users)
can issue the same commands.
Accuracy . Once you set it up, a script won't leave out a step or perform a series of steps
out of order.
Convenience . You don't have to remember how to do a process that you don't perform
often.
Automation . With script triggers, processes can run without you explicitly running the
script. In many cases, users won't even know a script is running. They'll just see the res-
ults.
Complex processing . Some processes just aren't possible (or maybe they're not feas-
ible) without a script handling the grunt work.
Most scripts you'll write will combine more than one of these advantages. Scripts are so use-
ful that complex databases often have hundreds of scripts (or even more). Even relatively
simple databases benefit from scripts, since reports usually require a similar sequence of
steps: finding records, sorting them, and showing a list layout in Preview mode. This chapter
introduces you to the basics, but two more chapters ( Chapter 12 and Chapter 17 ) dive deeper
into scripting.
Understanding Scripts
A script is a series of steps bundled together. When a script runs, FileMaker carries out all
the steps on your behalf, one after the other. You can create a script to automate almost any
Search WWH ::




Custom Search