I need help. I have a data (see below). Just wanted to ask if there is a shortcut to have the output? Thanks!
and the OUTPUT I need is:
(LIFNR ‘10000008’ OR
LIFNR ‘10000237’ OR
One way of doing this is to concatenate your columns using String Manipulation to get you the LIFNR ‘100nnnnn’ part which is common to all rows, then use Column Expression to “decorate” the rows with the bits which are specific to the first row, last row and other rows, based on the following logic:
Row 1: “(” + commonoutput + " OR"
Middle Rows commonoutput + " OR"
Last Row: commonoutput + “)”
See attached workflow.
KNIME_connecting_per_row.knwf (11.4 KB)
You could of course do the entire concatenation in Column Expressions and get rid of the String Manipulation altogether. It’s personal preference but I prefer to keep the “common” processing and the dynamic processing separated, and it also serves as a demo of different nodes. However, if you had a huge data set and performance were an issue, then bringing them into the one single node would probably be more efficient.
(edit - this is a related side message to @TotalDataLoss - this is my “future self” who, as I predicted, hasn’t wasted any time today because of the rowIndex bug you pointed out 6 days ago!
RowIndex calculated wrongly? - #9 by takbb)
Have modified it but too late to edit my previous post. This workflow also handles the unstated edge case of what happens when there is only a single row of data, so I modified the logic in the Column Expression…
// edit: special case if we only have the one row
… do the previous code
KNIME_connecting_per_row-2.knwf (18.3 KB)
Love the modified version @takbb , since it’s bullet proofing the workflow
Thank you again for your help!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.