Database Reference
In-Depth Information
Chapter 17. Advanced Scripting
Being familiar 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 affairs, many
scripts require forethought, planning, and organization. FileMaker gives you tools to help
you write scripts and 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.
NOTE
Download this chapter's sample file from this topic's Missing CD page at
www.missingmanuals.com/cds/fmp13tmm . Use Invoices_START.fmp12 to work in and use In-
voices_FINISHED.fmp12 to see the completed examples.
Commenting Scripts
When you look at a script someone else created—or you created a long time ago—you can't
always tell what the script does. To help keep things clear, add comments to your script. You
add each comment by using 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.
Second, it appears in bold when you view your script in the Edit Script window.
Use comments to document anything important about the script. Here are some things you
may want to include in a comment or set of comments:
▪ What the script does
▪ Who wrote the script
▪ The date the script was written
▪ The date, if any, the script was last edited
▪ Who edited the script
▪ Anything special about how or when the script should be run, like whether only some
database users can run it, or if the script requires parameters to do its work
Documenting scripts is standard operating procedure among FileMaker developers for a
couple of reasons. First, if something is wrong with the script, or it needs to be changed,
you've got extra information that may help. Good comments tell you exactly what the script
Search WWH ::




Custom Search