Database Reference
In-Depth Information
WARNING
Global variables are potential security risks, since the Data Viewer in FileMaker Pro Advanced will
reveal their values to anybody who knows their names and has enough privileges to run scripts. If
security is a big consideration in your business, make sure you don't leave sensitive data lying
around in global variables by resetting their values to “0” or “” when the script is done. In practice,
though, it's usually a lot easier, and cleaner, to use only local variables and rest assured that
FileMaker is cleaning up after you.
UP TO SPEED: NOTE SEPARATORS REVISITED
In the previous scripting chapter, you learned how to make the Add Note Separator script work with
any field (see the box on A Reusable Notes Separator Script ) . The only drawback is that you have to
click the field you want to work with before running the script. With script parameters, you can fix
this problem. Just add a series of If and Else If script steps to the top of the script. Each one
checks for a Notes field (Invoice::Notes, Job::Notes, Customer::Notes, and so on) in the script para-
meter.
For instance, if the script parameter is Invoice , then the script should use the “Go to Field” script
step to go to the Invoices::Notes field first.
With these conditions in place, you just need to pass the right parameter from your Add Notes but-
ton. Just add tests to check the script parameter and then use an appropriate Go to Field script
step, depending on which button the user clicks. Use the script described on Communicating with
Database Users to see how to do this kind of branching.
Now if you add a new Notes field to another table, you add an Else If and a Go to Field step to
this script. Then to change the way the note separators look or the data they contain, you can change
it in one place, and the change applies to every Notes field in the database.
Handling Errors
When an error occurs during a script (a Perform Find finds no records, for instance),
FileMaker shows an error message almost like the one it would if you were doing the steps
manually. The one difference is a button called Continue ( Figure 17-15 ) .
Search WWH ::




Custom Search