Database Reference
In-Depth Information
Luckily, you can opt for more control over error handling if you want it. FileMaker gives you
three functions for finding and dealing with errors that may happen when scripts run.
The Set Error Capture Script Step
The Set Error Capture script step lets you turn on
error capture
. That way, instead of dis-
playing potentially confusing error messages to your database's users, FileMaker keeps track
of error information (
captures
it) so you can pull it into your script and handle it there. Al-
though error capturing is a great feature, it's not part of FileMaker's normal behavior. You
have to activate it by adding the
Set Error Capture
step to your script, and choosing the
On
option. At any time in the script, you can turn it back off again by using the step a second
time and switching the option off.
If a script turns error capture on and then uses the Perform Script step to run another script,
the second script also runs with error capture on. In other words, the error capture setting
sticks around as long as scripts call other scripts. But as soon as script execution stops for
good, FileMaker turns off error capture. Understanding this behavior helps you determine
ure 17-16
shows a script that turns on error capture before performing a find and then turns it
back off when it's done.
As discussed in the box below, you can just turn error capture on so that your script ignores
any and all errors—but that's not good script writing. The best way to use
Set Error Cap-
ture
is hand in hand with the
Get(LastError)
function, described next, to achieve error-
free results.