Hi everyone, I am running a chunk loop in Knime to categorize data in a table on a row by row basis. I would like a way to bring the past categorization information from the previous iteration and use it in the next. For example, for the second iteration of the loop, I want access to the categorization I made and stored in the first iteration. Can anyone help me with this problem?
Well I can’t show an example now but point you in the right direction: you can achieve this using a recursive loop. It has ports that pass data back to the beginning of the loop so you can use it in the next iteration.
Unfortunately this makes these type of loops rather complex …
Hi @GhazwanG , welcome to the KNIME community forum.
As @MartinDDDD mentions, recursive loops will assist here, but they do add some complexity and take a little getting used to. Once you’ve understood how they work, things become relatively straightforward.
I’ve uploaded a recursive loop example which remembers values from the previous row on each iteration:
As you can see from the input and output tables, this loop acts like it is lagging column data from one row to the next. Hopefully the annotations gives some guidance but also look at the workflow description.
I hope that gives some pointers if you want to try the recursive loop.
An alternatives would be to write the information you wish to retain at the end of each loop iteration to a file (using Table Writer) (which has been created and initialised prior to the loop) and read at the beginning of each iteration (with Table Reader). This has a small file-writing/reading overhead, but can be workable. You can also use an H2 database for this purpose (read and write to a database table) instead of file writers, but that may be overkill.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.