Database Reference
In-Depth Information
subtraction. If you need FileMaker to do part of your calculation first , before moving on to
any other operators, put it in parentheses. The parentheses tell FileMaker to treat everything
between them as a single unit.
In the calculation below, FileMaker multiplies 3 and 2 before adding 4, and gives you a res-
ult of 10:
4 + 3 * 2
Even though the + operator comes first in the calculation, FileMaker follows the standard or-
der of operations. If you want to add 4 and 3 before multiplying, then you need to use paren-
theses:
(4 + 3) * 2
Thus, it sees that it needs to add 4+3 first, then multiply by 2, for a result of 14. You can see
the value of parentheses in calculations like the one below, which calculates the interest on
the sum of the balance and service charge. Without the parentheses, FileMaker would calcu-
late the interest on only the service charge and then add that to the balance due, with an en-
tirely different result:
(Balance Due + Service Charge) * Interest Rate
NOTE
If you have trouble remembering (nay, understanding) the order of operations, then just use paren-
theses when in doubt. It certainly doesn't hurt to be too explicit.
Functions
The meat of calculations is found in the function list (which you saw briefly back in Fig-
ure 9-3 ). A function is a predefined formula, and FileMaker's list covers most common cal-
culation purposes. If you find a function that already does what you want to do—like average
all invoices—use it. When you add these tried-and-true formulas to your calculations, you
save time and even help prevent errors.
For example, if you didn't know about functions, you could find your average with a series
of fields. First, you'd need to create a calculation field to total all the invoices in your found
set. Then you'd need another field to count the invoices in the set and a third one that divides
the first field by the second. It would work, but it'd be clumsy and inefficient, since you'd
have to create at least two fields that you didn't really need.
Search WWH ::




Custom Search