if (if, then, else)
See also: ifEmpty, ifNotEmpty, cmp (Compare), and (Logical And), or (Logical Or), not (Logical negation)
Evaluates a truth value (condition) and executes the then-expression (thenValue) if true and the else-expression (elseValue) if false.
The function returns the value of the executed expression.
Syntax
$if(condition,thenValue[,elseValue])
Parameter
Name |
Description |
condition |
An expression that is executed to determine a truth value (Boolean value). If the evaluated expression returns true, the expression thenValue is evaluated, otherwise the optional expression elseValue. |
thenValue |
A static value or expression that is evaluated and returned if the condition returns true. |
elseValue |
An optional value or expression that is evaluated and returned if the condition returns false. |
Return value
Returns the evaluated fixed value or the return of the evaluated expression. If the condition is false and no elseValue is specified, the function returns null/empty.
Example
Syntax |
Ergebnis |
$if(true,condition is true, condition is false) |
condition is true |
$if(false,condition is true, condition is false) |
condition is false |
$if(false,condition is true) |
null/empty |
$if($get($input,DANGEROUS_GOODS), true, false) |
true or false, depending on the content of the DANGEROUS_GOODS field of $input |