Struggling with Recursive Loop

Hi there and thank you for reading.

I am struggling with a recursive loop I am working on.

Task:

I am having a table with five rows where I want to replace values in certain cells, if a number matches the values from another table (also five rows).

For that, I am using the recursive loop.

Problem:

Either I am receiving all tables multiplied (25 exactly, because five rows multiplied with the other table.) Or I receive five rows, but only one table is updated. The last one.

Based on the description, it should work like this. But I don’t know what else to do.

I know, I could switch to a variable condition loop, but if there is already a build in function, why use another one.

Also I add two screenshots, eventually you can point me in the right direction.

grafik

Thank you

Patric

Hi @patric and welcome to the forum.

Recursive Loops can be a bit confusing sometimes, there’s no doubt about that. But maybe someone here can help troubleshoot. First, could you please upload your workflow with some dummy data, as opposed to screenshots? Probably no one wants to guess at the contents of all your Rule Engine nodes, and how you have constructed the logic. :slight_smile:

In the meantime, you might have a look at this short video to see if it helps:

1 Like

Hello @ScottF - thank you for your reply, I really appreciate that.

Attached you’'ll find a table with objects and colors. In another table for each color, there is an additional column (result).

This loop is also showing the same problem. Either I have only the last row updated, or all rows multiplied.

Kind regards

Patric
TEST_LOOP.knwf (17.4 KB)

Maybe you could try this. I added a Missing Value node and changed the arrangement of the branches to the Recursive Loop End node a bit.

I think this is your desired result, right?

2022-09-27 14_11_50-Collected data - 4_117 - Recursive Loop End

TEST_LOOP_SF.knwf (19.5 KB)

There is also a 1 node solution for this using the Joiner , but I’m guessing you are more interested in learning how the recursive loops work. :slight_smile:

2 Likes

Hi @patric , if your goal is to learn how to use Recursive Loop, then it’s fine, you can use Recursive Loop.

But if your goal is to complete the task that you want to do, it looks like Recursive Loop is not really the ideal solution.

As @ScottF mentioned, this can be solved via a Joiner node, which would be much faster than a Recursive Loop, or any loop for that matter (the reason being that with a Loop, you have to go through several iterations while the Joiner node will do everything in 1 iteration), and much simpler (most of the rule engines that you are applying might be applied already during the join).

Hello!

First of all thank you @ScottF - this seems to work for me. And also thank you @bruno29a . You are both right, I might be able to use join. The problem is, that the original table needs to be cross-checked with a lot of data and sometimes, the data must be processed, before it can be applied to the table.

Like “The is a match in one row, then please check, if the address is from the EU and if this is a yes, then set the currency to EUR”. (This is not an actual example, that needs to be processed.)

Might thought was, that with the loop and the rule engines, I am having everything I need. But I will check evaluate the Join-Node and also will keep on testing your suggestion.

BTW: The outdated 2-port Loop did exactly that.

Many thanks so far!

Kind regards

Patric

1 Like

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