Database Reference
In-Depth Information
routine task, and once it's working the way you want it to, you decide how and when the
script will run.
You can run a script from the Manage Scripts window or by selecting it from the Scripts
menu. But more commonly, you put a button on a layout, and have FileMaker run your script
when someone clicks the button. You can even use script triggers to make scripts run auto-
matically in response to what someone does. For instance, you can make a script run every
time someone goes to a particular layout, clicks into a certain field, or selects a tab panel in a
Tab Control. Using the Install OnTimer Script script step, you can make a script run
periodically or at a certain point in the future. Finally, you can run scripts on a schedule by
using FileMaker Server to perform automated imports, send emails, clean up data, and so on.
Scripting is FileMaker's real power feature, and there are as many ways to take advantage of
its scripting prowess as there are databases.
Scripts can be simple—just the same five steps you'd go through if you printed a report
manually. Or they can be much more complicated—and handle tricky or tedious tasks you
wouldn't want to do manually. Advanced scripts can even incorporate calculations to do dif-
ferent things in different situations by making decisions based on the data in your database,
the current time or date, or just about any other condition you want to test.
NOTE
If you've worked with other scripting environments—like Visual Basic for Applications, Ap-
pleScript, or JavaScript—then FileMaker's scripting commands are pleasantly familiar.
Your First Script
To get a feel for how scripting works, you'll create a really simple script. Suppose you want
to find all invoices with a balance due and view them in a sorted list. The following pages
show how to go about preparing your database, planning, creating, and polishing the script,
and finishing off with a way to run it.
Preparing the Database
Reports usually need their fields arranged differently from data entry layouts. You'll usually
use just a few of a table's fields, and they need to be positioned so they're easy to see and in-
terpret. Also, reports usually need to be suitable for printing. As you're writing a script, you
might realize that you need new calculation fields to get a report's summary data. FileMaker
is flexible enough to let you create fields and layouts on the fly, but it's easier to focus on the
Search WWH ::




Custom Search