"For each" pathing

"For each" pathing

hi everyone

im trying to implement a rather special logic and im getting the "Ambiguous paths to for each" error

--> For each 1 --> For each 2 --> IF

now if this IF is False, it proceeds with For each 2, untill completely looped
or if the IF is True, it should proceed to For each 1 (which is probably causing the error message)

is it somehow possible to abort a For each, before it has been completely looped?
so the 1st For each can be continued

thank you!
Hi Manuel,

as you said, it's true that you can't end "the inner logic" of a for each outside it.
The only ways you can end a for each before it finishes is either through a direct connection to an "End" object, or by raising an error. Neither of these options seems to suit you, as you want to continue with the first loop.

So you probably have to replace that second "for each" by a loop of your own so you can have full control of how it works.
You can do this by using recursion, or simply by using an "If" as loop in case recursion does't fit in that logic.

Best regards.
thanks for your reply antonio

what do you mean with recursion?
"To understand recursion you must first understand recursion." Jk.

I was talking about building some recursive action.
I believe the "If" loop might be what you're looking for. Either way just be careful and make sure you don't create infinite loops, it's quite easy when you leave the confort of the "for each" object. :)
ah now i get what you mean

calling an action for the 2nd loop, that will do single selects and return to the1st for depending on the IFs
but wouldnt this require more performance, compared to doing 1 select for all records?

thank you
The way you described it, it would take a toll on performance, yes.
Recursion basically means calling an action within itself, making it possible to reuse a whole logic to create an infinite number of results.

But as I've said, I don't know what your logic consists of, and (again) the If solution is more suited for general purposes.

No problem :)