Expressions
An expression can contain literals, operators and function calls.
#
LiteralA single value of one of the types.
#
Path ExpressionAccess a value by its name/path. For example, a given variable from the input/context.
If the value is a context (or data object/POJO) then the inner values can be accessed by context.key
.
Also, directly on a context.
Inside a context, the previous values can be accessed.
If the name or path contains any special character (e.g. whitespace, dash, etc.) then the name needs to be wrapped into single backquotes/backtick `foo bar`
.
#
Addition- supported types: number, string, day-time-duration, year-month-duration
#
Subtraction- supported types: number, time, date-time, day-time-duration, year-month-duration
#
Multiplication- supported types: number, day-time-duration, year-month-duration
#
Division- supported types: number, day-time-duration, year-month-duration
#
Exponentiation- supported types: number
#
Comparisonoperator | symbol | example |
---|---|---|
equal to | = | x = "valid" |
not equal to | != | x != "valid" |
less than | < | < 10 |
less than or equal | <= | <= 10 |
greater than | > | > 10 |
greater than or equal | >= | >= 10 |
between | between _ and _ | x between 3 and 9 |
The operators less than, greater than, and between are only supported for:
- number
- date
- time
- date-time
- year-month-duration
- day-time-duration
Any value can be compared with null
to check if it is equal to null
, or if it exists. Comparing null
to a value different from null
results in false
. It returns true
if the value, or the context entry (e.g. the property of a variable) is null
or doesn't exist. The built-in function is defined() can be used to differentiate between a value that is null
and a value that doesn't exist.
#
Disjunction and conjunctionCombine two boolean values.
#
If expression#
For expressionsIterate over a list and apply an expression (i.e. aka map
). The result is again a list.
Iterate over multiple lists.
Iterate over a range - forward or backward.
The previous results of the iterator can be accessed by the variable partial
.
#
Some/every expressionTest if at least one element of the list satisfies the expression.
Test if all elements of the list satisfies the expression.
#
Filter expressionFilter a list of elements by an expression. The expression can access the current element by item
. The result is a list again.
An element of a list can be accessed by its index. The index starts at 1
. A negative index starts at the end by -1
.
If the elements are contextes then the nested value of the current element can be accessed directly by its name.
The nested values of a specific key can be extracted by .key
.
#
Evaluate a unary testsEvaluates a unary tests expression with the given value.
#
Instance-Of expressionChecks the type of the value.
#
FunctionsInvoke a user-defined or built-in function by its name. The arguments can be passed positional or named.
A function (body) can be defined using function(arguments) expression
. For example, inside a context.
#
Special propertiesValues of type date, time, date-time and duration have special properties to access their individual parts.