IF THEN ELSE allows conditional assignments to be made, depending on the value of a Boolean expression. It is used for conditional formulas for calculated fields.
Both expression 1 and expression 2 are always evaluated.
| Syntax: | IF expression THEN (expression1) ELSE (expression 2) |
| Return Value: | NCDTY value_to_assign |
| Description: | IF THEN ELSE allows different assignments to be made, depending on the value of a boolean expression |
| Example: | IF 109 THEN 25 ELSE 5 = 25 |
Field DISCOUNT might have a formula:
IF ORDER_VALUE > 500 THEN 0.1 * ORDER_VALUE ELSE (IF ORDER_VALUE > 200 THEN 0.05 * ORDER_VALUE ELSE 0)
to give zero discount on orders up to 200, 5% on orders over 200 and up to 500, and 10% discount on orders over 500