ToList Function
Lists provide a structured way to manipulate and combine pieces of text, and allow you to use data to drive template logic. By converting text into a list of substrings, you can perform various string operations more efficiently.
Use the ToList function to convert text to a list of text strings.
Description 1 of 2 (convert multi-line text to a list of text values):
When the second parameter separator is not specified, the ToList function can be used to convert a multi-line text value to a list of text values, whereby each separate line becomes an individual member of the list.
Line breaks in a text value are represented by the escape sequence ^L.
Returns:
Text*
Parameter:
Parameter | Data Type | Description |
|---|---|---|
1 | Text | The text to be converted. |
Examples:
When using functions inside a field, remember the field brackets:
{ToList(VariableName)}
Expression | Result |
|---|---|
ToList( "abc" ) | List( "abc" ) |
ToList( "a^Lb^Lc" ) | List( "a", "b", "c" ) |
ToList( "a^Lb^L^Lc^L" ) | List( "a", "b", "", "c", "" ) |
Description 2 of 2 (convert text to a list of text values by specifying a separator):
If the substrings are not separated by a line break, you can specify the separator in the second parameter of the function.
Returns:
Text*
Parameter:
Parameter | Data Type | Description |
|---|---|---|
1 | Text | The text to be converted. |
2 | Text | Text string representing the separator. |
Examples:
When using functions inside a field, remember the field brackets:
{ToList(VariableName)}
Expression | Result |
|---|---|
ToList (“a b c”,” “) | List( "a", "b", "c" ) |
ToList (“a ,b ,c”,” ,”) | List( "a", "b", "c" ) |
ToList( "a^Lb^Lc","^L” ) | List( "a", "b", "c" ) |