Download User Manual Version 3.0

Transcript
Appendix D: IIF Statements
The IIF function will operate on information you supply within the parentheses. The
commas within the parentheses separate the three parts of the IIF function, which are: (argument, result1, result2). If the IIF function were “spoken in plain English,” it would sound like this:
“If such and such a condition is true, then automatically generate this response; otherwise, if the
condition is not true, generate this alternate response.” The “such and such condition,” “this
response,” and “alternate response” in the plain English sentence above is what gets placed
within the parentheses of the IIF statement. How do you know what to enter for the “argument,”
“result1,” and “result2”?
After “IIF ( , , )” has been entered in the Expression Builder Edit window, click your
mouse between the open parenthesis and the first comma. This is where you will enter the
“argument.” Arguments typically compare the data from a specified database field with a value
that you supply within this parenthesis. For example:
•
•
•
[company] = “Delta”
[PrintCount] > “2”
[ExpDate] BETWEEN #01/01/1999# AND #12/31/1999#
Note that the first word in these examples is the actual name of a database field;
database fields must always be enclosed within square brackets ( [ ] ). The field name is followed
by an Boolean operator (=, <, >, And, etc.); the Boolean operator describes how you want
the data in the database field compared to the value you will supply next. The final element
of the argument is the actual data (text, dates, or numbers) which you will specify. Therefore, you may create any “argument” or “condition” that you want. Do you want something
to be inserted on a badge if the individual’s company equals “Delta”? Do you want something to be printed on the badge if the badge has been printed more than two times?
Expression Builder will “test” this argument...it will look at the contents of any database field
you specify here, and see if it matches the data you instructed it to compare it to. If the
actual database field contents match what you supply in the argument, Expression Builder
will insert whatever you supplied for “result1” onto the badge; if there isn’t a match, Expression Builder will print whatever you specified for “result2.”
Let’s create an argument. Let’s say that you’re willing to print your employees’ first
three badges at company expense, but that they must pay $15 for each additional badge if
161