Is there any method to getting out of the forEach() like any break loop method?
Discussion posts and replies are publicly visible
Nope. You can add an if condition in the a!forEach() and where you want to add a break, you can start putting null instead. And in the end, you can reject all the null values. -UPDATE-Adding the code block below.
reject( a!isNullOrEmpty(_), a!forEach( items: enumerate(10), expression: if(fv!item < 5, fv!item, null) ) )
What kind of logic do you want to implement that you need a break for? In case you are looking for something more complex, check out my blog post: https://appian.rocks/2022/08/29/complex-algorithms-in-appian/
instead of null, have it output empty set ({}). These will disappear from the output array (unless all results are an empty set - if this corner case is possible just wrap the a!forEach() in a!flatten() and the list of empty sets will be collapsed to an empty set).
Wow. Didn't know that. Thanks, Mike!