Logical Functions
The logical function group is a diverse and powerful lot. You get functions for making decisions (called conditional functions), learning about field values, and even evaluating calculations inside other calculations. This section covers all those possibilities. Along the way, you learn how to define and use variables, which act as placeholders while complex calculations go through their many steps.
Conditional Functions
This chapter began by posing an interesting challenge: You have a calculation field in the Invoices table called Total Due. It calculates the total amount due on an invoice by subtracting the sum of all payments from the total amount of the invoice. Can you modify the Total Due calculation to add a five-percent penalty when an invoice is past due?
The answer lies in the three conditional functions. Each one lets you specify more than one possible result. The functions require one or more parameters—called conditions or conditional expressions—that tell them which result to pick. The conditional functions—If, Case, and Choose—differ in how many possible results they support and what kind of conditions they expect.
The If function
The first and most common conditional function is simply called If. The If function is the basic unit of decision making in FileMaker calculations. It’s the ticket when you have to decide between two choices, based on some criteria.
It looks like this:
If ( Condition ; True Result ; False Result )
When you use the If function, ...
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.