From Dwayne Wright PMP
Certified FileMaker Developer
Please Note: If you are viewing this page in a news feeder, the images may get munged up a bit. For the best experience, please visit the journal directly by clicking (here).
Here we have a very simple example file. I have included two find buttons, however, neither one will find any records. The point of the example is to show how you can script a different experience for your users based upon what errors they may encounter.
The first button performs a regular find and then throws up a classic FileMaker dialog box. This dialog box contains the three choices of Cancel, Continue or Modify Find. If the current database user is someone unfamiliar with FileMaker, they may easily get confused by these choices.
What we would like to do is to simply inform the user that no records were found and go back to Browse mode with all records in the found set. We can do that with the second script tied to the button Find With Get(LastError) function Enhanced. This button runs a script that detects the 401 No Records Found Error. It tells the user this is what happened and simply goes back to browse mode.
Below is the sneak peek at the script.
ABOUT SET ERROR CAPTURE
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.
An example file can be downloaded by clicking (this link)
More info about the author and FileMaker in general, contact me at email@example.com.
© 2007 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.