How to split a multirow string in different rows?

Hi guys,
Maybe this is a stupid question but I cannot find a solution. If I have a single cell with a multi-row string, how can I split it in different rows?
Thanks in advance
Gio

1 Like

Hi,

you can use a Cell Splitter node with the delimiter \n for that. Make sure to check: Use \ as escape character and tick Output As List.

Then connect an Ungroup node to split the collection column into individual rows.

Example workflow:

– Philipp

7 Likes

Hi,
I’ll take a quick stab at it. Here’s one way:

First count the number of lines in the cell. You can do this with the String Manipulation node and the expression count($multiLineText$, "\n") + 1.
Next use the One Row To Many node to create a separate row for each line of text (use value from previous step to specify number of rows to create).
Next use Math Formula to number each line (make col name = “line num index”).
Finally use Column Expressions and the expression split(column("multiLineText"), "\n")[column("line num index")] this expression creates an array of lines by splitting the multiline text using the delimiter “\n” (line end character).


First Table:
image
Last table:
image
See attached workflow. You’ll probably need to tweak it to meet your needs and make it more robust. To make it work for a whole table enclose it in a loop (e.g. Chunk Loop Start using n=1, and Loop End nodes). Hope this helps. -Don

split lines within cell.knwf (13.2 KB)

5 Likes

Great. Thank you both!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.