cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Do Until Loop Termination

In a Do Until loop, with a condition (such as a certain variable is greater than 1), at what point does the do Until loop stop?  Does it stop at the beginning of the iteration when the condition is met (and thus does not implement actions below it once the condition is met) or does it see that the condition is met, run the loop once more, and then quit?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User II
Dual Super User II

Re: Do Until Loop Termination

In my experience it evaluates the condition at the top of the loop.  So if the condition is true when you enter the loop it will never execute the actions inside the loop.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

5 REPLIES 5
Highlighted
Dual Super User II
Dual Super User II

Re: Do Until Loop Termination

In my experience it evaluates the condition at the top of the loop.  So if the condition is true when you enter the loop it will never execute the actions inside the loop.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Highlighted

Re: Do Until Loop Termination

It should do the actions once and then move on

 

Do (run the actions) then Until (check the condition)

Highlighted
Advocate II
Advocate II

Re: Do Until Loop Termination

Thanks for that answer, very helpful. One other question.  Will a Do Until work properly if it is embedded inside an Apply to Each loop?  In my case, I am checking a condition to see if it is true, but I need an apply to each loop for to check each record in a SharePoint list.  I'm not sure if Do Until works properly inside a loop.  See screenshot. "Loop daily list" is an apply to each loop that gets records (items) from a SharePoint list, then uses an item from that list in the do until comparison.  I am trying to get the list loop to exit once the condition is met, to avoid unnecessary repetitions.

 
 
Highlighted
Advocate II
Advocate II

Re: Do Until Loop Termination

my post below did not seem to keep the screenshot.  Trying again.DoUntilFlow.png

 

Highlighted
Advocate II
Advocate II

Re: Do Until Loop Termination

From my testing, I have not found a way to exit a loop before all items in the Apply to Each loop are completed. I tried using a Do Until loop with a condition, but as soon as the condition involves multiple items from a SharePoint list, an Apply to Each loop is added, and that loop will not exit until all items have been checked.

My conclusion is that loops which involve checking multiple items in a list or library cannot be exited early based on conditions.  We really need a "break" function.

If anyone has figured out a way to exit a loop (where repeating items are involved), please let the community know.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (2,157)