cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Runner55552 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
Dual Super User
Dual Super User

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
Dual Super User
Dual Super User

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

Re: Do Until Loop Termination

It should do the actions once and then move on

 

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

Runner55552 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
Runner55552 Advocate II
Advocate II

Re: Do Until Loop Termination

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

 

Runner55552 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
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (8,084)