cancel
Showing results for 
Search instead for 
Did you mean: 

Exit from "Apply to Each"

I want to exit from "Apply to Each" for exit the loop.

In some case, the loop does not need processing items after specific item.

 

Regards,

Yoshihiro Kawabata

Status: Under Review

Thank you for suggesting this idea, it is a good suggestion!

Comments
Level: Powered On

This should be a must and really cannot take that long to develop

Level: Powered On

I would love an "Apply to each while/until" function. I am developing a flow that loops through rows of a large Excel table and searching for keys in another large Excel table. If I could cut out of the loop early once it's found, it would save lots of time.

 

As for the workaround mentioned, I'm not sure a Do Until loop can iterate through a List Rows object (?)

Level: Power Up

I've been waiting a long time for this. Would be a killer feature!

Level: Powered On

I also need this feature.... anybody know any workaround with current features?

 

*exit from "Apply to Each" for exit the loop*

Level: Powered On

@jeffadn - I don't believe it is possible. You will want to plan accordingly. You could either create a condition which skips over all the other records, which means it is still processing to the end.  Or you could filter the results down ahead of time. There is a Filter control, and some others that might help. 

Level: Powered On

How did nobody not think of this? Really?

I have 3000 items, I found match at ID 2, flow still goes through 2998 items. The heck?

Level: Powered On

@rcdf  Yeah I don't know what @Stephen is going on about.


Do until will apply a something until a condition is met. Awesome! What if I don't want that condition to applied? Which in that case we are back to condition checking.

 

First things you learn in programming is getting out of loops and this dude is talking about "voted" on features. Dude, this is a necessary thing that should have come with the loops in the first place.

 

Why am I checking 3000 items when I found my match at 1? Doesn't match any sense

Level: Powered On

@mykelboachie - Yep. The only viable idea I have seen to date was to use a Filter command to pare down the results to a smaller dataset ahead of time to reduce the volume of processing.   http://aka.ms/FlowConf2019

 

Side note, I still have to go back and use SP Designer for very simple workflows that would otherwise create an infinite loop in Flow. Seriously, like basic 1 liner workflows for each time a list item is created then update  column X to some value. 

Level: Powered On

@rcdf  Thanks, this is crazy.. Unfortunately In my case, I can't really filter down since I need everything in there updated. It just drives me insane cos some of them are matching at 4, yet it goes down the whole 3000 list items for each 1 item in sql list. Yikes!

Level: Powered On

There could be a workaround butbut I haven't triedtried it.

 

You can filter the array.

See veenstra's amazing blog. Where would Flow be without  it

https://veenstra.me.uk/2018/12/18/microsoft-flow-filter-data-in-an-array/