Thursday, January 24, 2008

Set Error Capture Script Step

SET ERROR CAPTURE SCRIPT STEP

CATEGORY: Troubleshooting
CLASS: Scripting
VERSION: All Current Versions

We all have had the experience of encountering a FileMaker error message. The most common occurrence is when FileMaker tells you that it didn't find any records that match your settings in a find command. Which isn't so much an error as a condition message from FileMaker.

Here you can see the traditional FileMaker message error message for an unsuccessful search.

Some of the messages you get from FileMaker after an error might be confusing, particularly to the users that are not familiar with FileMaker. In particular, FileMakers default error message system does not know in what context the developer wrote the script. So it has no way to best customize the error message to make the best sense in the business logic used. That is where the developer can step in and lend a hand.

In the Control family of script steps, the Set Error Capture step is the fundamental first step that allows ScriptMaker to detect errors in advance and instead of showing a FileMaker error message ... allows the developer run a set of script steps.

When Set Error Capture script step is included in a script and is set to the ON position, the FileMaker pop up error dialog boxes to the user are suppressed while the script is running. You then can use the IF, ELSE and END IF scripts steps are part of your error handling routine.

You can do a number of things when an error is detected such as return your own error message elaborating on the condition, run a set of subscripts that may resolve the problem and/or log the error condition for later illumination.

Here are some links to other posts that might be of interest in regards to this topic...
The Set Error Capture Script Step
Script Troubles
POTENTIAL ISSUE: RECORD LOCKING
Potential Issue: New Feature Meets Old Version Of Filemaker
Control Family Of Script Steps