Evaluates a String input against the Array datatype. If the input matches, the function outputs an Array value. Input can be a literal, a column of values, or a function returning String values.

After you have converted your strings to arrays, if a sufficient percentage of input strings from a column are successfully converted to the other data type, the column may be retyped. 

Tip: If the column is not automatically retyped as a result of this function, you can manually set the type to Array in a subsequent recipe step.


parsearray(strInput)

Output: Returns the Array data type value for strInput String values.

parsearray(str_input)


ArgumentRequired?Data TypeDescription
str_inputYStringLiteral, name of a column, or a function returning String values to match

str_input

Literal, column name, or function returning String values that are to be evaluated for conversion to Array values.


Required?Data TypeExample Value
YesString'[1,2,3]'


Example - parsing strings as an array

Source:

The following table represents raw imported CSV data:

setIditemsAitemsB
s01"1,2,3"4
s02"2,3,4"4
s03"3,4,5"4
s04"4,5,6"4
s05"5,6,7"4
s06"6,7,8"4

In the above table, you can see that the two items columns are interpreted differently. In the following steps, you can see how you can parse the data as array values before producing a new column intersecting the two arrays.

Transformation:

Create a new column to store the array version of itemsA:

Remove the quotes from the column:

Now create the array by merging the array text value with square brackets and then using the PARSEARRAY function to evaluate the merged value as an array:

You can create the second array column using a similar construction in a new column:

Since both columns have been parsed as array values, you can use the ARRAYINTERSECT function to find the common values:

Results:

setIditemsAitemsBarrAarrBarrIntersectAB
s01"1,2,3"4[1,2,3][4][]
s02"2,3,4"4[2,3,4][4][4]
s03"3,4,5"4[3,4,5][4][4]
s04"4,5,6"4[4,5,6][4][4]
s05"5,6,7"4[5,6,7][4][]
s06"6,7,8"4[6,7,8][4][]