Loop to create only one column not all

Continuing the discussion from Calculating new column (1) as input for new calculated column (2) as input for new calcluated column (up to ~60) etc.:

Hello all,
I have a table with 5 colums, only the last one of them is the column I need to loop through and apply a math formula and attach as the new column. With the workflow referenced, I was able to create newly incremented calculated columns, but with the insert of each new column the workflow also inserted all 4 other columns every loop.
How can I limit the loop to only one column in the table?
Thank you!

Wondering if a “Column List Loop Start” node would be helpful here? Might be able to filter the other columns out?

I used the Filter column before the loop. So now I loop through only one column, however after the loop I end up missing all my other columns. How can reattach my lost columns (without repeating the originally used for the loop column)?

I think I had a similar situation…in my “Loop End” I had to check the box “Leave row Ids unmodified” and check the box for “Add iteration Column”…then you can filter columns and you still know your iteration that you might be able to join back on…not sure though. Hoping other experts on here can help.

Hi @IrynaK,

Let’s see if I have understand your issue. You have 5 columns as input and you want to do some manipulation only on the last one. But it is a repetitive process and you want to do it in a loop. So you are using some regular loop start and the Loop End (Column Append). Also, you are using the Column Filter node before the loop to exclude other columns. After the loop, you have your new columns and want to add the excluded columns.

If you it was only the Math Formula node and you have the same row IDs in the output of the loop as in the input, it’s very easy to use the Joiner node to use the Row ID column as the joining column and join the output of the loop with your original table before column filtering.

If your row IDs are getting changed, it is possible to magane it by using the RowID node or even by manipulating the IDs to reproduce the original ones.

And just another hint:
We can use this regex pattern in the Column Filter node (select “Wildcard/Regex Selection” and then “Regular expression”) after the Loop End (Column Append) to exclude those duplicate columns like “column name (Iter #2)”:

((?! \(Iter #\d+\)$).)*

:blush:

Hi @IrynaK,

Prior to Column List Loop Start node use Column Splitter node and after loop is ended use Column Appender node.

Br,
Ivan

1 Like

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