Database Reference
In-Depth Information
Chapter 9. Understanding Calculations
When you learned about tables, fields, and relationships in the previous chapters, you
dabbled in FileMaker's calculation dialog box. Most people first encounter the Specify Cal-
culation window when they're creating a calculation field, so it's easy to think that's the only
place it's used. True, writing formulas for calculation fields is probably the most common
use of FileMaker's calculation engine (that's the fancy name for the code that handles math
for your database), but that's far from the only use, as you'll see in this chapter.
No matter where you run into the Specify Calculation window, it works the same way. You
use that window's field list, operators, and predefined functions to tell the calculation how to
find the value you need. This chapter tells you how the basic concept works.
While calculations can make your database total invoices, analyze trends, and calculate dates
and times, they aren't limited to number-crunching tasks. You can use them to find out about
the computer your database is running on, track who's logged into the system, monitor their
privileges and then perform logical tests based on what you find. You'll start by learning how
FileMaker handles calculations and then you'll see how some common functions can take
your database up to a new level of power.
Understanding Calculations
Way back on Creating a Simple Calculation , you saw how to create a field that's defined as a
calculation. A calculation is a mathematical formula that manipulates the information in your
database to give you the answers you need. For example, for a line item on an invoice, you
need to multiply the price of an item by the quantity to get an extended price. To hand that
task over to FileMaker, you create a calculation field and then write a formula that refers to
the appropriate fields by name. FileMaker takes the information in the invoice fields and
does the math.
NOTE
The exercises in this chapter refer to the Jobs database from this topic's Missing CD page at
www.missingmanuals.com/cds/fmp13mm .
FileMaker calculations can also do more than math. For starters, you can do calculations on
time, date, timestamp, container, and text fields, too. (See the box below for an example.)
Calculation fields work just like any other FileMaker field, except that you can't type data
into them. The calculations you give them determine what data they show. If you change the
Search WWH ::




Custom Search