To get a feel for how scripting works, you'll create a really simple script. Suppose you want to find all invoices with a balance due, and view them in a sorted list. The following pages show how to go about preparing your database, planning, creating, and polishing the script, and finishing off with a way to run it.
Reports usually need their fields arranged differently than, say, data entry layouts. Those summary fields have to be positioned so they're easy to see and interpret. Also, reports often need to be suitable for printing. As you're writing a script, you might realize that you need new calculation fields to get a report's summary data. FileMaker is flexible enough to let you create fields and layouts on the fly, but it's easier to focus on the script if you create all your supporting material before you even open the Manage Script window.
In practice, you can't fully prepare a database until you've done some planning…and your preparation can reveal flaws in your plan. Work with the assumption that the plan and preparation phases of scriptwriting overlap and intertwine.
For this report, your list layout should include the Invoice ID, Job Name, Date, Date Due, and Balance Due fields. Figure 10-1 shows the List layout from the Invoices START database for this chapter. At the end of the chapter you can compare your work to the Invoices FINISHED database. Both are available on this book's Missing CD page at www.missingmanuals.com.
Figure 10-1. To follow along in this chapter, you need an Invoices with Balance Due layout like this one. If you want to express your creativity, or review the process for creating layouts, feel free to roll your own report layout.
Before you dive in and create the script, you should review what you want it to do. A script is just a series of steps that FileMaker repeats for you. When you're planning a script, it often helps to manually work through the...