Use a TableRow to Variable Loop to add new columns to a table


I have a workflow that loads published excel sheets from a folder. I have a loop that reads all the files does a bunch of things and then saves them to an "output" folder.

I need to create 10 new empty columns which is easy enough to do with 10  Constant Value Column but this is rather clumsy and rigid. I would like to able to manage the columns added with a list maintained as a CSV file which would be simpler and alot more flexible.

This is the workflow currently:

I have the CSV Reader (top most row of modules) that reads the CSV file with a new column names which is linked to the Table Row to Variable Loop module. The CSV Reader and the Loop Start are fine until I connect it to the Constant Value Column module to create the new columns I get this error: 

Unable to merge flow object stacks: Conflicting FlowObjects: <Loop Context (Head 0:54, Tail unassigned)> - iteration 0 vs. <Loop Context (Head 0:5, Tail unassigned)> - iteration 0 (loops/scopes not properly nested?)

When the Constant Value Column module is connected no variables are available, obviously becuase of the above error.

I want to use the AddColumn variable as the Flow Variables/new-column-name input to create the new columns. 

Any help would be hugely appreciated.



one problem is that your loops are not clearly separated. It always must be clear which nodes should be executed inside the loop and which ones outside.

You can generate this order by connecting nodes via the flow variable port.

E.g. connect the loop file names with loop start add column node and connect the loop end add columns with the loop end filenames.

It also might help to collapse the inner loop into a meta node.

Best, Iris