Hello!
Looking for some assistance with the split function not recognizing a comma as a delimiter for an array of numbers.
I found the following SQL from the examples linked below:
SEARCH / AS @a EX('Col 2'->split(",")) /
RETURN(@a->'Col 1' AS 'Col 1', _ AS 'Col 2') FROM T1This will not work on the following table because they are all numeric characters
| Col 1 | Col 2 |
|---|
| Row 1 | 111. 222 |
| Row 2 | 333 |
| Row 3 | 444, 555 |
if you proceed to modify the SQL to the following by converting 'Col 2' to strings, it still wont work
SEARCH / AS @a EX('Col 2'::string->split(",")) /
RETURN(@a->'Col 1' AS 'Col 1', _ AS 'Col 2') FROM T1The only way for this SQL to work is to enter a "character" into the values like so - notice the ' before the 111:
| Col 1 | Col 2 |
|---|
| Row 1 | '111. 222 |
| Row 2 | 333 |
| Row 3 | 444, 555 |
My workaround to this issue is the following modifications to both SQL and data - i change from <,> to <;> and it will work.
SEARCH / AS @a EX('Col 2'::string->split(";")) /
RETURN(@a->'Col 1' AS 'Col 1', _ AS 'Col 2') FROM T1| Col 1 | Col 2 |
|---|
| Row 1 | 111; 222 |
| Row 2 | 333 |
| Row 3 | 444; 555 |
Research:
Flatten an array in Table transformer macro
Splitting cell values in a column to different rows