Your First Script
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.
Preparing the Database
FileMaker is flexible enough to let you create fields and layouts on the fly, at the same time as you write a script, but it’s easier to focus on the script if you create all the supporting material you need before you even open ScriptMaker. In this example, you’ll need a layout that shows a list of invoices, so create that first:
Switch to Layout mode in your database and choose Layout → New Layout/ Report.
The New Layout/Report window appears.
From the “Show records from” pop-up menu, choose Invoices. In the Layout Name box, type Invoice List.
Since you’ll tell the script which layout it needs to use, it helps to name the layout appropriately so you can pick it from the list of layouts later.
In the “Select a layout type” list, select “Columnar list/report,” and then click Next. Leave the “Columnar list/report” radio button turned on, click “Constrain to page width,” and then click Next again.
These options save time when you rearrange your fields.
Click to add the following fields to the “Layout fields” list: Invoice ID, Jobs::Name, Date, Date Due, and Balance Due. When you’re finished, click Next, then a second time to skip the Sort ...
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.