Database Reference
In-Depth Information
FREQUENTLY ASKED QUESTION: RESULT TYPE
Why do I have to tell FileMaker my calculation has a number result? I'm multiplying two numbers
together, so isn't it obvious?
You're right; FileMaker can figure that out for itself. In fact, in a calculation where you're perform-
ing simple math, the field always has a number result. But the ability to set the result type for a field
gives you a good measure of control.
For one thing, you and FileMaker may have different ideas about what type a result should be. Take
this calculation, for example:
1 & 1 * 3
Because you're mixing concatenation (&) and math (*) operators, it's not terribly obvious what that
calculation will produce. A number? Or just a numerical text value? So FileMaker lets you say what
you want it to produce. If it doesn't do what you expect, then you can easily fix the calculation, but
at least you don't have to wonder what type of field you have.
Furthermore, setting the type explicitly prevents FileMaker from changing it later. Imagine if a
simple change to your calculation accidentally changed the result type from number to text. If you
try to reference this field in a calculation or a relationship, then you get strange results. And it might
take you a while to figure out that the problem is due to FileMaker calculating a text value instead of
a number, rather than a mistake in your calculation.
Understanding the Specify Calculation Dialog Box
As you saw in the previous tutorial, whenever you create a new calculation field, FileMaker
shows the Specify Calculation window (see Figure 9-3 ). This window is loaded with options,
making it seem a bit daunting—but all those buttons are there to help you. FileMaker shows
you the table occurrences, fields, operators, and functions, and all you have to do is point and
click to build any calculation you have in mind.
Once you learn how this box works, you can write calculations like a pro without memoriz-
ing complicated functions and/or typing out long field names. The following pages give you
a guided tour of each element in the window.
Table Occurrence Context
Since FileMaker sees your database from the perspective of one table occurrence at a time,
you have to specify which context you want the calculation to be evaluated from. The Con-
text pop-up menu lists every occurrence of the current table—the one you're adding a field
to—on the Relationship graph. All you have to do is pick the one that works for your pur-
Search WWH ::




Custom Search