Database Reference
In-Depth Information
evolves from the general to the specific. The most specific version is the script itself,
where you tell FileMaker exactly what to do.
Exceptions . What kinds of things can go wrong? Think about how you'll check for er-
rors and prevent problems.
Efficiency . Are you doing the same things in several places in the script? Are there other
reasons to break your script into multiple smaller scripts?
NOTE
The rest of this chapter is one long exercise. Here you'll get a chance to put theoretical concepts to
practical use. Since each section builds on the one before it, this complex script is best digested if
you work straight through from here to the end—without skipping parts or jumping around. And
while you may not need this exact process in your databases, the techniques are applicable to any
complex scripting situations.
Planning the Script
Planning a big script is usually an iterative process. You start by outlining the steps the script
will take in very general terms. You then go in and fill in more and more detail with each
pass. When you're done adding detail, you know exactly what steps your script will use.
Using the invoicing script as an example, you'll see how FileMaker gives you the tools to
plan and execute your new script.
You can do this planning on paper, or in a word processor, or with any other tool you choose.
But one good place you may not think of is the script itself. Since the planning process in-
volves a series of steps, and since it naturally produces the finished script when it's done,
make notes with comment script steps. As you work, replace the comment lines with real
script steps, and perhaps more comments explaining the process. That way, you never get
lost or forget essential steps because you always have a comment to tell you what you still
need to add, and where it should go. When you're done, the script is written and commented
for posterity.
For this script, take a look at the script shown in Figure 17-20 . To save you time, it's already
created for you in the sample database for this chapter ( Invoice START.fmp12 ).
Considering Exceptions
One of the most critical steps in script writing—planning for exceptions—is often forgotten.
But the old saw “A stitch in time saves nine” truly applies to scripting. Spend a few minutes
at the beginning of the process thinking ahead to what might go wrong and planning how to
Search WWH ::




Custom Search