Data Transformation Engine Functions and Expressions Reference Guide
Chapter 3 - Function Reference IF
Functions and Expressions Reference Guide
126
IF
The IF function 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
This function 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)
Uses
Use
IF for conditional logic. For example, to return one of two objects
depending on the evaluation of a condition.
See the
PRESENT function in this chapter for another use of IF.