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. For example, X < Y. TrueValue
and FalseValue
are numbers, strings, or formulas.
The comparative operators are:
- N1 > N2 greater than
- N1 < N2 less than
- N1 @= N2 equal
- N1 <> N2 not equal to
- N1 >= N2 greater than or equal to
- N1 <= N2 less than or equal to
The logical operators are:
- AND is the logical AND: (X < Y) AND (X > Z)
- OR is the logical OR: (X < Y) OR (X > Z)
- NOT is the logical NOT: NOT(X < Y)
The values used in conjunction with logical operators must be enclosed in brackets.
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')