iif

Returns one of two values, depending on whether the condition value gives a true result or a false result.

Function

iif(condition, true-result, false-result)

Arguments

ArgumentData Type
conditionany
true-resultany
false-resultany
resultany

Comments

The true-result and false-result calculations should both return the same type of data. This may be a record data type.

The calculation iif( some-condition, true, false ) is always redundant and can be rewritten simply as some-condition. Similarly, the calculation iif( some-boolean-field = true, option1, option2 ) can be rewritten as iif( some-boolean-field, option1, option2 ).

Tip: consider using the case feature if you need to select between multiple options.

Examples

iif(grade>80, 'good', 'bad')
iif(hour(gettime())<12, [Morning contact person], [Afternoon contact person])