WHEN
You can use the WHEN function in a component rule to test for the validity of one object based on another object.
The WHEN evaluates a condition. Then, based on that evaluation, evaluates another condition and returns "true" or "false".
- Syntax:
- WHEN ( single-condition-expression , single-condition-expression [ , single-condition-expression ] )
- Meaning:
- WHEN ( condition1 , condition2 [ , condition3 ] )
- Returns:
- "True" or "false"
The following statements summarize how the WHEN function works:
- Returns "true" if condition1 and condition2 both evaluate to "true".
- Returns "true" if condition1 evaluates to "false" and there is no condition3 or if condition1 evaluates to "false" and condition3 evaluates to "true".
- Returns "false" if condition1 evaluates to "true" and condition2 evaluates to "false".
- Returns "false" if both condition1 and condition3 evaluate to "false".
Evaluation of the three arguments:
Condition 1 | Condition 2 | Condition 3 | WHEN returns: |
---|---|---|---|
True | True | True | |
False | True | ||
False | True | True | |
True | False | False | |
False | False | False |
Examples
- WHEN (ABSENT(CatalogueField), ABSENT (QuantityField))
Returns "true" when CatalogueField and QuantityField are both absent
- WHEN (PRESENT(ShipDate), PRESENT(InStock), PRESENT(BackOrderDate
))
Returns "false" when ShipDate and BackOrderDate are both absent