Lookup and derive a series of dummy variables with lookup contents in a loop

I have reviewed posts and documents on looping, and I still can’t figure out how to set up a loop to create a series of dummy variables by a string search for each code in a column expression node for each record in file 1, using each of the codes in file 2 as search strings in the expression and as column names appended to file 1 as output.
Thanks for any help or suggestions you can offer.

Hi @dataminer_1 , if you read the file via File Reader, each record will appear in separate rows in a Knime table. Any operations that you apply to a Knime table will be applied to each row, without you having to implement a loop to go through each record manually. So you would not need a loop.

Also, I am not sure why you need “a series of dummy variables”. Variables and columns are 2 different things. If you are using column expression node, you will replace or create new columns, and it looks like you want to append new columns.

There are different ways to implement the string search, depending on how the data on both files is. Can you please share some sample data of File 1 and File 2, and also show what is the expected output/results for the sample data?

EDIT: Here’s a quick example about operations applied to all rows of a table without needing a loop:

My input table contains the days of the week:

And my operation is to remove “day” from each of the rows and add the result in a new column via a column expression:

And the result:

As you can see, the operation was applied to each and every row without a loop. Knime does it for you


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