Convert to list
Syntax
$expr.toList()
Description
Converts the result of evaluating expr
into a list. The following cases can occur:
expr
is already a list:expr
is returnedexpr
is any collection (e.g. set):expr
is converted to a list.expr
isnull
: An Empty set is returned.- For all other values a one-element set is created, see Wrapping up.
Parameter
Name | Type | Description | Mandatory | Default |
---|---|---|---|---|
expr | Number/string/boolean/business object/set | An expression whose evaluation is to be converted into a list. | yes |
Return value
Type: Set
A list representing the values from expr
.
Examples
Converting a list
list(1, 1, 2, 3, 3).toList()
Output: A list with the elements [1, 1, 2, 3, 3].
Since this is already a list, it is simply returned.
Conversion of a scalar value
toList(1)
Output: A list with the element [1].
Conversion of null
toList(null)
Output: An empty list