Node in Loop Body which only returns on the final iteration of the loop


#1

Hey there,

I am making a node which is to be used within the loop body of a chunk reader.

I am wondering if it would be possible for me to make it only return a DataTable output on the final iteration of the loop, perhaps returning null on all other iterations?

I appreciate your help :slight_smile:

P


#2

This behavior sounds like it should be how your loop end node should work, not necessarily a node within a loop body, as you won’t really be able to put any node behind this one and have your loop continue to run.
Do you plan to accumulate some state during the loop executions and return the final state in the last iteration? While this might be technically possible by making use of Flowvariables being sent from the Loop Start node downstream, nodes within a loop body should really note carry data state between iterations, you are opening the door to many problems with inconsistent node behavior with this. For example: what happens when I put such a node outside a loop? What if I want to only perform one loop step and view the intermediate results? …

What exists as a concept in KNIME is a Recursive Loop nodes, which allow you to pass data from one iteration to the next:


Also the Active Learn Loop node combines recursive loop results one one port still providing the original input on a different one.

I think doing something in that direction should be a good start.
best,
Gabriel


#3

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