Loop Start /Loop End - Not doing UNION because an outer-filter table with join in another loop before.

Hi Friends,

I need to create a header row for each item that is iterated over. But when I create the end loop, in the end loop node itself, the UNION does not occur because the outside table always varies because of the JOIN.
How do I save the values ​​and do the UNION, without the previous value being overwritten?

Explanation:

In the photo above, it is the table desired end result.
Notice the “0” column: it is the id_product information.
Each id_product has a header how.
It turns out that my flow, which has several Group Start loops, which first performs the filter on a fact table with a dimension table and I group each id_product to make a calculation (which I will not explain here).

It turns out that, in order for me to assemble the header, I first need to know which id_product the JOIN will be performed on, and then I want to create a header in a separate LOOP so that only later can I perform the UNION on the result.

In the image below, the table number 4, is me trying to create a Header and store for each iteration.
But compare to table number 3, its possible to see that I have two id_products. So, in my header table, I expected to see two lines, for each id_product.

I think this is not happening right because my Loop flow (table4) is always changing because the Join from the first Group Loop (table 1) to (table2), and because that, the UNION is not occurring in table4 and only shows the last id_product.

(i gave an example only with two differents id_products, but I have to do that in 2000.

*I don’t want to connect directly my loop into the table2, because my table2 will be larger, and the flow will create header rows for all lines tha exists in table2, and I want to create header only, if the JOIN finds an id_product in table2.

Any ideas friend? @takbb
Header - Creation.knwf (39.1 KB)

Hi @Felipereis50,

If you want to collect all the values from each recursive loop, add a loop end node at the end of the flow. Let me know if this solves your problem or not.

Best,
Keerthan

3 Likes

Hi friend.
It Worked :slight_smile:

:fist_right: :sparkles: :fist_left:

I did what you have explained in picture.

But, I don’t really understand what is Recursive loop.
I didn’t find any good simple examples.

Thanks for your time to help me. :slight_smile:

2 Likes

Hi @Felipereis50,

Here is a simple example of Recursive Loop, as mentioned in the Recursive Loop End documentation the loop runs until one of the three stopping criteria is met:

  • Maximum number of iterations: to ensure no endless loop is created, the loop will end after the set number of iterations.
  • Minimal number of rows: to ensure enough rows are present for processing, the loop stops if one of it’s recursion input tables contains less rows than the set minimum. This minimum can be set for each recursion input table individually.
  • End loop with variable: the loop ends if the option is enabled and the value of the selected variable equals “true”.

Best,
Keerthan

3 Likes

Owww
I see.

When I configure the recursive loop’s end, it will restart the loop, incrementing the last value stored in memory from the first loop until the configured number of iterations is reached.

Thanks for the explanation. :clap:

3 Likes