Chapter 15. Advanced Scripting
Familiarity with FileMaker’s lengthy list of script steps is a great foundation, but putting together a workable script takes practice. Although some scripts are simple five-line affairs, sometimes a script requires a lot of forethought, planning, and organization. FileMaker gives you tools to help you write scripts and to troubleshoot them when they aren’t working. Plus, you can organize and document your work as you go. In this chapter you’ll pull these concepts together to learn how to write and manage complex scripts.
When you look at a script someone else created—or you created a long time ago— it isn’t always obvious what it’s trying to do. To help keep things clear, add comments to your script. You add each comment via a Comment script step. This step has just one option: the text of the comment itself. The comment step is special for two reasons. First, it doesn’t do anything except say whatever you tell it to say. Second, it shows in bold when you view your script in the Edit Script window. You can see a commented script in Figure 15-1.
Asking and Telling the User
Sometimes a script needs to tell your users something—“There are no records to include in this report”—or ask the user a question—“How many copies of the report do you want?” To this end, the Show Custom Dialog script step can display a dialog box that you control. Calling it a “Custom” dialog box might be a bit too generous (you don’t have much say in how it looks), ...