Workflow - Always join two tables inside a loop

Hi there,
I would like to implement a parallel loop into this workflow.

In each of the two list files/folders nodes, I am reading in 5 different tables with different columns.

I would like to achieve the following order of workflow execution:

  1. Execute the first loop iteration of the red part (read table 1 of folder A)
  2. Execute the first loop iteration of the blue part (read table 1 of folder B)
  3. Join the output tables from the blue and red part (join tables 1A and 1B)
  4. Execute the second loop iteration of the red part (read table 2 of folder A)
  5. Execute the second loop iteration of the blue part (read table 2 of folder B)
    6. Join the output tables from the blue and red part (join tables 2A and 2B)

So far, I only achieved a slightly different workflow execution order:

  1. Execute the first loop iteration of the red part (read table 1 of folder A)
  2. Execute the first loop iteration of the blue part (read table 1 of folder B)
  3. Join the output tables from the blue and red part (join tables 1A and 1B)
    4. Execute the second loop iteration of the blue part (read table 2 of folder B)
    5. Join the output tables of the red part of the first iteration and the blue part of the second iteration (join tables 1A and 2B)

How can I ensure to first execute the second loop iteration of both the blue and red part and only then join the tables? Thanks!

Hi @jana_knime,
welcome to the KNIME forum!

If you don’t want to let the full blue loop be executed for every instance of the red loop, I don’t think you would need the blue loop start at all. For example, you could try a row filter instead, where the retrieved row number is controlled via variable of the current loop iteration. For this, replace the blue Group Loop Start node with a Row Filter node (also add the variable connection to it). On the Filter criteria tab, select to include rows by number in the left side menu. Then, change to the Flow Variables tab, expand the tree by clicking on the plus symbol, and then select currentIteration in the drop down menu for RowRangeStart and RowRangeEnd.
Does this provide the wanted execution order?

By the way, I assume that you only return one row per iteration in the group loop start. As you generate in the next step variables from the row, you could also use the Table Row To Variable Loop Start instead.

2 Likes

I would try to put everything in one loop and create 2 branches in the loop.
br

1 Like

Another vote for just adding additional ports to a single loop process.

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