Putting a Complex Script Together

Building a complicated script takes time and planning. Given the flexible nature of scripting, you could script a given process many different ways, and outside the artful application of your business’s rules to your database, there is no one way. Your job is to find a good way.

In this section, you’ll make a script that generates an invoice for a job. It gathers all the unbilled expenses and timeslips for the job, and adds appropriate line items for them to the invoice. To make a script like this, you need to cover all your bases:

  • Planning. Without writing the actual script, what will your general approach be? Can you outline all the things your script will do, and in the right order? This process usually evolves from very general to somewhat specific. The most specific version is the script itself, when you’ll tell FileMaker exactly what to do.

  • Exceptions. What kinds of things can go wrong? How do you check for, and prevent, those problems?

  • Efficiency. Are you doing the same things several places in the script? Are there other reasons to break your script into multiple smaller scripts?

Tip

The rest of this chapter is one long exercise. Here, you’ll get a chance to put some theoretical concept into 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.

Also, you can see the process of building and testing this script ...

Get FileMaker Pro 9: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.