Join colum,ns based on results of last join column

image

I want to implement a loop in KNIME that keeps performing the join operation until there are no more matching records (i.e., the join result is empty). The first join uses Col ‘Part_No.’ and joins it with bottom table col ‘COMPNT_PART_NBR’. the output includes col ‘ASSEMBLY_PART_NBR’ from the bottom input table and Part_no from the first table.

now the second join will join the join the column ASSEMBLY_PART_NBR (level 2) with COMPNT_PART_NBR from the bottom table. the third join will use ASSEMBLY_PART_NBR (level 3) with COMPNT_PART_NBR. so and so forth. How can i create a loop for this until there are no matching COMPNT_PART_NBR for the ASSEMBLY_PART_NBR (level n).

Try to combine the “Empty table filter” with a “Variable Condition Loop End”. The condition to end to loop is set in the lower port of the empty table filter which is only active if there are no more results. In your case, a variable with 0 (continue) and 1 (end loop) should do the job.

Hi,
without having more details on the data I think the recursive loop would be helpful:

The lower port at the “Recursive Loop End” is send back to the start node and enters the joiner in the next iteration. If we use the second output of the joiner node, where the unmatched rows of the top table are linked to, it should work.

The recursion ends automatically if the table in the lower port of the end node is empty.

4 Likes