Selector¶
Picks one of two values based on a boolean or a comparison between two values.
Selector operates in two modes — boolean and comparison.
In boolean mode, the first parameter is a boolean field reference.
The second parameter is selected when the boolean is TRUE; the third
(optional) parameter is selected when it is FALSE. Without a third
parameter, NULL is used for the false branch.
In comparison mode, the first and third parameters are the values
to compare. The second parameter is the comparison operator: <, =,
>, <=, <>, or >=. The fourth parameter is selected when the
comparison evaluates to TRUE; the fifth (optional) parameter is used
for the false branch (defaults to NULL).
Parameters¶
Boolean mode¶
- 1 —
conditionMandatory — accepts: field -
A boolean field reference whose value drives the selection.
- 2 —
trueValueMandatory — accepts: field, BOOLEAN, DATE, FLOAT, INT, STRING -
Value chosen when the boolean is
TRUE. - 3 —
falseValueOptional — accepts: field, BOOLEAN, DATE, FLOAT, INT, STRING -
Value chosen when the boolean is
FALSE. Defaults toNULLwhen omitted.
Comparison mode¶
- 1 —
leftMandatory — accepts: field, BOOLEAN, DATE, FLOAT, INT, STRING -
First value of the comparison.
- 2 —
operatorMandatory — accepts: STRING -
Comparison operator. One of
<,=,>,<=,<>,>=. - 3 —
rightMandatory — accepts: field, BOOLEAN, DATE, FLOAT, INT, STRING -
Second value of the comparison.
- 4 —
trueValueMandatory — accepts: field, BOOLEAN, DATE, FLOAT, INT, STRING -
Value chosen when the comparison is
TRUE. - 5 —
falseValueOptional — accepts: field, BOOLEAN, DATE, FLOAT, INT, STRING -
Value chosen when the comparison is
FALSE. Defaults toNULLwhen omitted.
Input type¶
BOOLEANDATEFLOATINTSTRING
Output type¶
The output type matches the second parameter (boolean mode) or the fourth parameter (comparison mode).
Requires¶
- In comparison mode the first and the third parameter must have the same type.
- If a third parameter (boolean mode) or fifth parameter (comparison mode) is present it must have the same type as the true-branch value.
- In comparison mode the operator must be one of
<,=,>,<=,<>,>=.
Examples¶
Comparison mode — equal
Comparison mode — less-than with default false branch
Comparison mode — not-equal dates
Comparison mode — greater-than producing string
Boolean mode
See also¶
Equal, NotEqual, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, Min, Max