Recursive loop to build/append to a table with each iteration.

Hi all,

I’ve been exploring with a bit of looping. In the attached screenshot, I’m basically just picking an input folder via List Files, processing each file, then writing each modified file to an output folder.

My procedure right now is to do that, then combine all of the outputs with a batch script, then filter out the duplicate headings in KNIME and write the final combined csv.

My hope is to change the last step of my loop from ‘write to csv’ to ‘append to table’, and have that table grow with each iteration, so all I have to do at the end is save that table.

I think I need to use recursive loops to achieve this, but I’m not sure where those nodes would go with relation to my existing loop. Maybe there’s a better way to achieve this than recursive loops?

Thank you for any advice!

Hi @braunnz

I think you are almost there instead Variable Loop End use an Loop End node . Be aware you have to change the Standard Settings in this node (e.g. allow changing table specifications) but that depends on your in put files. Hope this helps.
gr. Hans

3 Likes

Hi @braunnz,

Have you noticed the “Append” option in the configuration window of the CSV Writer node?

:blush:

4 Likes

@armingrudd You just made me smack my own forehead… but in a great way! I’ve seen that option tons of times when always selecting ‘Overwrite’ … I don’t know why it never occurred to me to consider using Append instead.

Thanks for the direction!

4 Likes

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