Convert to list

Syntax

	$expr.toList()

Description

Converts the result of evaluating expr into a list. The following cases can occur:

  1. expr is already a list: expr is returned
  2. expr is any collection (e.g. set): expr is converted to a list.
  3. expr is null: An Empty set is returned.
  4. 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