Database Reference
In-Depth Information
For example, the result of this calculation returns “Free” if the First Name field matches
“Dominique.” If it
doesn't
match, then it returns $299.00 instead. (See the box on
Matching
Text Values
for more details.)
FREQUENTLY ASKED QUESTION: MATCHING TEXT VALUES
What do you mean by “First Name field matches 'Dominique'?” What constitutes a match?
When you use the = operator with text values, FileMaker compares the two values on each side, let-
ter by letter. If every letter, number, space, punctuation mark, and so on matches, then you get a
True result. But the comparison isn't case-sensitive. In other words, this expression has a True res-
ult:
"TEXT" = "text"
If this function is too forgiving for your needs, then you can use the
Exact()
function instead.
Exact takes two text parameters, compares them, and returns True if they match exactly—including
case. This expression has a False result:
Exact ( "TEXT"; "text" )
It's perfectly legal and quite common to use the Exact function (or any other function, field, or ex-
pression) as the first parameter of the
If()
function, like this:
If ( Exact ( First Name ; "Dominique" ) ;
"Free" ; "$299.00" )
This version of the calculation will return “$299.00” if the First Name field contains “dominique,”
since the case on the letter D doesn't match.
The Case() Function
Sometimes you need to pick from more than just two choices. Luckily, the
If()
function has
a cousin named
Case()
that simply excels at such problems. For example, suppose you want
to show one of these four messages on the top of your layout:
▪ Good Morning
▪ Good Afternoon
▪ Good Evening
▪ Go To Bed
FileMaker chooses a message based on the time of day. The
If()
function doesn't work very
well for this problem because
If()
allows only one condition and two possible results. You
can
nest
If()
statements one inside the other, so that the False result is really another
If()