Understanding Calculations

A calculation is a mathematical formula: It shows how different things combine to come up with an answer. But even if you hated algebra class, don’t close the book yet! Instead of the Xs, Ys, and Zs of the math world, FileMaker lets you use your own fields to supply your formula with data—a much more intuitive approach.

FileMaker calculations can also do more than just math. For starters, you can do calculations on time, date, timestamp, container, and text fields, too. (See the box on The Structure of a Calculation for an example.) Way back in Chapter 3, you learned that FileMaker can create calculation fields (see Timestamp). Calculation fields work just like any other FileMaker field, except that you can’t type data into them. Instead, they use a calculation to determine their own value.

You can use a calculation field just like any other field: Put it on a layout, use it in Find mode, and even use it in other calculation fields. But as a calculation field, its value always stays up-to-date automatically. If the price or quantity changes, the calculation updates the data in your field without you doing anything. Figure 9-1 shows where calculation fields could benefit your invoices’ layout.

Without calculations, you have to manually calculate the extended price for each line item by multiplying the quantity times the price. You also have to type in the invoice total after a trip to your desktop calculator. To make your job easier and minimize errors, you can use calculation fields to do these jobs for you. You can even make the Date Due field a calculation, so it’s always 30 days after the invoice date. Extended prices Invoice total

Figure 9-1. Without calculations, you have to manually calculate the extended price for each line item by multiplying the quantity times the price. You also have to type ...

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.