TOLIST

Syntax

TOLIST (expression, delimiter, type, sort, remove_quotes, remove_empty)

Description

Hierarchical data supports collections or lists of simple types, such as string, integer, char, etc. When working with hierarchical data you may need to convert from a string to a list or from a list to a string. See FROMLIST.

Use TOLIST to transform a single delimited string into a list of simple types.

When using XML as the source or target datastore, your XSD might look similar to the example below for a List of Integers:

<xs:element name="myNumbers" type="xs: integer" minOccurs-"0" maxOccurs="unbounded"/>

TOLIST("1,2,3,4,5", ",") transforms into a List containing 1 2 3 4 5 and which can be stored in element myNumbers.

Arguments

expression String of values
delimiter Character used to separate values, such as comma (,), period (.), or pipe (|).
type Data type, can be any of the following:
-bit
-bool
-boolean
-byte
-char
-datetime
-datetimeoffset
-decimal
-double
-double64
-float
-guid
-int
-int16, integer16
-int32, integer32
-int64, integer64
-integer
-long
-object
-short
-single
-string
-timespan
-uint16, uinteger16
-uint32, uinteger32
-uint64, uinteger64
-uinteger
-ulong
-uniqueidentifier
-ushort
sort Optional parameter:
"a" = ascending
"d" = descending
Must be the fourth parameter.
remove_quotes Optional parameter:
Boolean
true = Remove quotes from string values. (Default)
false= Do not remove quotes from string values.
Must be the fifth parameter.
remove_empty Optional parameter:
Boolean
true = Remove empty string values.
false = Ignore empty string values. (Default)
Must be the sixth parameter.

Returns

An object or list.

Remarks

If the data type is incorrect, it may result in a record error when a flow containing this function runs.

Sorting is case insensitive.

Optional parameters must occur in a specific position to be honored by the function. To use any optional parameter you must include all of the other optional parameters that go before it in the sequence. For example, to use the remove_quotes parameter, you must include the sort parameter first.

If a parameter is not in the correct position in the sequence, the function misinterprets the setting. If you only include remove_quotes, the function treats it as the sort parameter because it is in the position that sort occupies in the sequence. Since the true/false values for remove_quotes are not valid for sort, that setting is ignored. The default value for remove_quotes, true, is used.

Example

TOLIST ( myProperty, ",", "string", "a", false, true )
Where the value of myProperty = "H","Z","A"

Returns:

Related Topics

FROMLIST