โ03-14-2022 09:17 PM
Hello Workato Community,
Is there a way to exit a ForEach loop given a specifc condition (like in a WHILE statement)?
I'm just looking for an ID in a list and I want to stop the ForEach once the ID is found.
I added an IF condition inside the ForEach but, as per my understanding, this would just prevent the following steps inside the ForEach from being executed, but the ForEach would still need to iterate through the whole list.
Thank you,
Filipe
โ03-15-2022 02:00 PM
You should looking into droppong your list into a collection then execute SQL against the collection to get your desired entry / entries. I have found this extremely useful for limiting iteration as well as nested looping, greatly reducing the complexity and size (number of actions) required for various recipes.
โ03-15-2022 02:24 PM
โ03-15-2022 02:37 PM
I've added a link to EU Costomers
โ03-16-2022 09:16 PM
Hi Omri - doesn't the Stop Job exit the entire job? What if you want to continue processing after you leave the loop?
โ03-28-2022 07:42 PM
Hey Kris, because the error that is being thrown is inside of the Monitor block, it just exits the loop, and the following steps after the On Error block will continue to be executed.