# Using Loop result for next Iteration

Hello,

I am sitting on several Problem which figured out the same root.

As Example: I need to create an Order Cascade from our CRM Data.
Order No is the number for the Order
RequestOrder is the Request, wihich created the new Order.
|ORDERNO|REQUESTORDER|
| aaaaaa | aaaaaa |
| bbbbbb | aaaaaa |
| abcdef | bbbbbb |
| dghjgjs | bbbbbb |
| dhjkgfj | dghjgjs |
| zzzzzz | bbbbbb |

Now I have to create the Cascade, which means an result like this:
| aaaaaa | aaaaaa | 0 |
| bbbbbb | aaaaaa | 1 |
| abcdef | bbbbbb | 2 |
| dghjgjs | bbbbbb | 2 |
| dhjkgfj | dghjgjs | 3 |
| zzzzzz | bbbbbb | 2 |

Cascadelevel 0 is easy to create in Rule Engine Node. All other Cascade get an defined "missing"value like -999
I donâ€™t know have many levels the cascade can have. My Dataset includes >100.000 rows, so it is not possible to do it manually

In my Theory I have to an create nested loop.
First Loop which filtered the last Cascade level and get all OrderNo.
Which this OrderNo i have to create the next cascadelevel. This should be â€śTableRow to Varâ€ť Loop.
The Result with new cascadelevel must be the source for next iteraration step of the first Loop. If all rows has an cascadelevel, the first loop must be finished.

Now I didnâ€™t get my Therory ito KNIME. I am wondering how can i get the result of an Loop as Source for next Iteration Step. Every Step uses the same Source without the new cascadelevel.

May can anyone help me? Is my Theory to solve an correct solution. If there any other suggestions?

Marcus

Hi @MarcusG

Sorry for this very quick reply but please have a look at examples where the recursive loop is used, for instance

or

The recursive loop may be your solution.

Hope this helps.

Best

Ael

5 Likes

That was the missing Point. Now it works.
Thanks a lot

5 Likes

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