FROMLIST
Syntax
FROMLIST (expression, delimiter, sort, add_quotes)
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 list to a string or from a string to a list. See TOLIST.
Use FROMLIST to transform a list of simple types into a single delimited string.
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"/>
FROMLIST(myNumbers, ",")
transforms into a string "1,2,3,4,5"
Where myNumbers = 1 2 3 4 5
Arguments
expression | An array of objects. |
delimiter | Character used to separate values, such as comma (,), period (.), or pipe (|). |
sort | Optional parameter: "a" = ascending "d" = descending Must be the third parameter. |
add_quotes | Optional parameter: Boolean true = Add quotes around string values. (Default) false= Do not add quotes. Must be the fourth parameter. |
Returns
A string.
Remarks
Function attempts to discover the appropriate data type based on the contents of the object.
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 add_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 add_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 add_quotes are not valid for sort, that setting is ignored. The default value for add_quotes, true, is used.
Example
FROMLIST ( myObject, ".", "a", true )
Where myObject = [ 7, 50, 1000, 300 ]
Returns:
"\"7\".\"50\".\"300\".\"1000\""