Wait for other loops iterations before looping.

Hi all,

Please excuse my lack of knowledge, I'm fairly new to all of this.

So at the moment, I have a 'List Files' node connected to a 'Table Row To Variable Loop Start' node connected to a CSV Reader. 

I have the exact same thing above it as well. Both CSV readers are connected to a Joiner and then a load of stuff happens after that (Also where do I put the 'End Loop' node?).

What I want to happen is to loop through the top 'List Files' 3 times, and the bottom 'List Files' to loop once. 

Once the top has reached 3 iterations, then the bottom one should loop to the next file. 

I haven't the foggiest on how to even go about this. Any help is appreciated.

 

Many thanks,
Daniel

Hi Daniel,

welcome to KNIME!

Honestly it would be much easier to understand how your workflow looks like and therefore help you if you would share at least a screen capture of it. In the Forum you can easily attach a screen capture as image file.

If you have two loops and need one to wait for the other to finish before it starts, there are several ways to do that depending if the loops are interwinded, independent, etc.

The classical way is to have two loops connected one after the other sequentially (meaning LOOP 1 START. --> ... some nodes... --> LOOP 1 END --> LOOP 2 START --> ... some nodes... --> LOOP 2 END). In this way the second loop starts only after the first one has finished.

Your case may be different though. If you want to loop 3 times and then enter another loop, you could use the Counting Loop Start node and set the Number of loops parameter to 3. If you want to loop on a table, 3 rows at a time, you can use the Chunk Loop Start and set Rows per chunk parameter to 3. In both cases there is a outer loop (looping 3 times or over 3 rows) and a inner loop, doing the the rest.

LOOP 1 START (3 times) ---> LOOP 2 START ---> ... more nodes... --> LOOP 2 END --> LOOP 1 END 

In this case you can tell KNIME End Loop node corresponds to which Loop Start node by establishing a connection on the respective Flow Variable ports. Or you can use semaphore files together with the Wait... node to wait for something to happen before triggering another part of the workflow.

As you can tell there are endless possibilities, it all depends on what you want to achieve which, from your description above, it is not entirely clear to me. 

Regarding where do you place the Loop End node (and there are a few different ones available), in general this is where you need to bring back together the results of each loop. Say that you loop 3 times on same data and each time produce 5 new rows of data, the End Loop goes where you need to bring the 3 x 5 rows back together for futher processing in your workflow.

In general each Loop Start needs a Loop End somewhere, so if you have two loops with two Loop Start nodes you also need two Loop End nodes.

Hope this helps at least to get you on the right track. Feel free to share your workflow so you can get more specific help.

Cheers,
Marco.