Database Reference
In-Depth Information
represents the number 3: “B.” (Remember that the first result is for zero , so 3 is actually the
fourth result parameter. For more detail, see the box below.)
Constructing a Conditional Calculation
Now that you've seen the three conditional functions, it's time to take a stab at that calcula-
tion way back from the beginning of this chapter: Add a five-percent penalty when the due
date has passed.
When you're trying to come up with a logical calculation, think about what information
FileMaker needs to make the decision and what action you want FileMaker to take after it
decides. Then consider how best to do that using your database's existing fields and struc-
ture. First, decide which conditional function to use.
FREQUENTLY ASKED QUESTION: NO ZERO
The Choose() function insists that the first parameter should be for a zero condition. What if I don't
want zero? My condition values start with 1 .
You're in a common predicament. Luckily, you have two equally easy ways to get what you want
from the Choose() function. Perhaps the most obvious is to simply add a dummy zero result:
Choose ( Door ; "" ; "European Vacation" ;
"New Car" ; "Wah Wah Wah" )
In this calculation, there's no Door number zero, so you just stick “” in the spot where the zero result
belongs. You could just as well put “Death by Boredom” there, since it never gets chosen anyway.
Just make sure you put a set of empty quotes there, so your first real result is in the number-one
spot.
If you just don't like having that dummy result in your calculation, then you can take this approach
instead:
Choose ( Door - 1 ; "European Vacation" ;
"New Car" ; "Wah Wah Wah" )
This version simply subtracts one from the Door number. Now Door number one gets the zero res-
ult, and Door number two gets the one result. This approach becomes more appealing when your
choices begin with an even higher number:
Choose ( Year - 2000 ; "Dragon" ; "Snake" ;
"Horse" ; "Sheep" )
Since this calculation uses the year as part of the condition, it would be a real drag to enter 2000
dummy values. Instead, you just subtract enough to get your sequence to start with zero.
Search WWH ::




Custom Search