Combining text data in a column across multiple rows with the same ID

How do you combine text in a column in the KNIME platform across multiple rows with the same ID, and put the combined text into a single row for that ID? This column is a comment, and there are multiple comments in separate historical rows per ID. I want to flatten this historical series of rows and output a single row for each ID with the combined text in it. I tried using the Lag Column node within a Group Loop to set up separate columns with the contents of previous rows for the ID, and then used the Column Expressions node to combine the comments into a single text string prior to text mining operations, but the results were inconsistent. Also, I see no way to collapse the series of rows for an ID into a single row with the combined text in it (the Rule Based Row Filter node can’t do it). I could do this in C or Perl (and I expect also in Python), but I see no way to do it in KNIME. I could try to do it through a Perl Scripting node, but I rather not go that route; my Perl expertise is rusty.

Group by with concatenate or Unique concatenate could do the trick.

kn_example_text_combine_multiple_rows.knwf (18.5 KB)


Outstanding! There were some duplicate comments per ID, and the Unique Concatenate option did the job right.
Thanks for the help!

1 Like