Returns one of two values depending on the value of a logical expression.
Syntax
IIF(lExpression, eExpression1, eExpression2)
Returns
Character, Numeric, Currency, Date, or DateTime
Arguments
lExpression
Specifies the logical expression that IIF( ) evaluates.
eExpression1, eExpression2
If lExpression evaluates to true (.T.), eExpression1 is returned. If lExpression evaluates to false (.F.), eExpression2 is returned.
Remarks
This function, also known as Immediate IF, evaluates a logical expression and then returns one of two expressions. If the logical expression evaluates to true (.T.), IIF( ) returns the first expression. If the logical expression evaluates to false (.F.), IIF( ) returns the second expression.
Tip This function can be used in place of IF ... ENDIF for simple conditional expressions, and is especially useful in report and label expressions that conditionally specify field contents. The IIF( ) function also executes faster than an equivalent IF ... ENDIF.