IF

Returns one value if a logical expression is true and another value if the expression is false.

Syntax

IF(TestExpression, TrueValue, FalseValue)

TestExpression is a logical expression that can contain comparative and logical operators. For example, X < Y. TrueValue and FalseValue are numbers or strings. They can also be expressions that return a number or a string.

Examples

This example returns 1:

IF(1 < 2, 1, 'OK')

This example returns OK:

IF(1 > 2, 1, 'OK')

This example returns OK:

IF((2 > 1) AND (2 < 3), 'OK', 'Not OK')

This example returns OK:

IF(NOT(2 < 1), 'OK', 'Not OK')

This example returns 'Yes':

IF(GETATTR('Product', 'Car Tires Summer', 1, 'APRODUCT') @= 'Tanja.Saarbruecken@Genesis.com', 'Yes', 'No')