IF
You can use the IF function for conditional logic. For example, to return one of two objects depending on the evaluation of a condition.
IF evaluates a conditional expression, returning one value if true, another if false.
- Syntax:
IF (single-condition-expression , single-general-expression
[ , single-general-expression ])- Meaning:
- IF (test_this , result_if_true [ , result_if_false ])
- Returns:
- A single item or single group
If test_this evaluates to "true", the result is result_if_true.
Otherwise, if test_this evaluates to "false", the result is result_if_false. If no result_if_false is specified, this evaluates to "none".
The result_if_true and result_if_false arguments must correspond to the same item interpretation or the same group type or either can be "none". For example, if result_if_true evaluates to a number, result_if_false must also evaluate to a number. If result_if_true evaluates to a LineItem group, result_if_false must also evaluate to a LineItem group.
Examples
- IF (Quantity:LineItem:PO >
500, "PRIORITY", "REGULAR")
This example tests the Quantity value. If that Quantity is > 500, the IF function evaluates to the value PRIORITY. If that Quantity is <= 500, the IF function evaluates to the value, REGULAR.
- IF (Status:Order = "Special",
"SPCL")
This example tests the Status value. If the Status is Special, the IF function evaluates to the value, SPCL. Otherwise, it evaluates to "none". Notice that this rule is equivalent to
IF (Status:Order = "Special", "SPCL", "none")