ARRAYTOSTRING function

Synopsis
This function returns a string containing the source array's elements (sequentially joined), optionally separated by a character and formatted.
Variations
ARRAYTOSTRING(SourceArray)
Returns a string representation of all of the source array's elements.
Parameters
SourceArray

Specifies the array to convert to a string.

Supported types: Numeric array; String array; Boolean array.
Returns
Returned types: String.
Examples
1.

The following example converts the array to a string. The function returns "1234".

ARRAYTOSTRING([1, 2, 3, 4])
ARRAYTOSTRING(SourceArray, SeparatorCharacter)
Returns a string representation of all of the source array's elements, with the specified character in between each element.
Parameters
SourceArray

Specifies the array to convert to a string.

Supported types: Numeric array; String array; Boolean array.
SeparatorCharacter

Specifies the character placed between the elements in the string returned.

Supported types: String.
Returns
Returned types: String.
Examples
1.

The following example converts the array to a string, with a comma in-between each element. The function returns "1,2,3,4".

ARRAYTOSTRING([1, 2, 3, 4], ",")
ARRAYTOSTRING(SourceArray, SeparatorCharacter, Format)
Returns a string representation of all of the source array's elements, with the specified character in between each array element, and formatted according to the specified format.
Parameters
SourceArray

Specifies the array to convert to a string.

Supported types: Numeric array; String array; Boolean array.
SeparatorCharacter

Specifies the character placed between the elements in the string returned.

Supported types: String.
Format

Specifies the format to use for numeric arrays.

For more information about user-defined number formats consult MSDN at http://www.msdn.microsoft.com, and search MSDN for "user-defined numeric formats (format function)".

Supported types: String.
Returns
Returned types: String.
Examples
1.

The following example converts the array to a string with a semi-colon and space in-between each element, and with only 2 decimal places conserved. The function returns "1.11; 2.22; 3.33; 4.44".

ARRAYTOSTRING([1.11111, 2.22222, 3.333333, 4.44444], "; ", ":F2")
2.

In addition to specifying decimal places, the Format parameter can specify the width of the formatted value. Note that when using a monospaced font like Courier, specifying the width can help align results over multiple rows.

The following 2 example expressions would produce a text file formatted like the one below, if used as TextWriter step inputs:

The functions return their respective results neatly separated and aligned.

{ARRAYTOSTRING(SELECT(FilterElongation.BlobFound, Item.Area, " |", ",10:F1")}\r\n
{ARRAYTOSTRING(SELECT(FilterElongation.BlobFound, Item.Elongation), " |", ",10:F1")}\r\n