web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : +OhOglnHKkojtpE6zLdR3a
Power Automate - General Discussion
Unanswered

Stopping a do until loop

Like (0) ShareShare
ReportReport
Posted on 31 Jul 2023 11:20:48 by 15

Currently I have a do until variable is equal to yes loop to read a document and sort that document based on if it finds characteristics. Before this I had the condition functions outside the apply to each functions, but I wanted to make my flow go faster because the condition functions were only checked after the document was fully read, so if the characteristics were already found at page 1 there was a huge bottleneck. To fix this I used a do until function, but now I get put into an infinite loop that keeps on running if no characteristics are found. Is there a way to terminate the do until function when the document is fully read or perhaps there is a better alternative, im pretty new at Power Automate?

I have the same question (0)
  • wqpoekqpokeq Profile Picture
    15 on 31 Jul 2023 at 11:30:51
    Re: Stopping a do until loop

    Another problem by the way is that, if there are no characteristics found, then I want to move the file to a specific directory. If i put it in the if not condition, then it will move the file prematurely, because if the first line doesnt contain the characteristics, the if no condition is triggered

  • Matthy79 Profile Picture
    4,178 Super User 2024 Season 1 on 01 Aug 2023 at 06:21:04
    Re: Stopping a do until loop

    Hello @wqpoekqpokeq 

     

    In general: You can define multiple exits for a loop. Something like “or(condition1, condition2)”

     

    But I think we should avoid loops whenever possible. You have 3 loops inside each other with conditions and so on. That is slowing down power automate because it is not designed to do this. What are you exactly trying to achieve? Read a pdf and see if it contains specific text? The goal would be to get rid of all the loops.

  • wqpoekqpokeq Profile Picture
    15 on 01 Aug 2023 at 06:44:09
    Re: Stopping a do until loop

    So within my company there are different type of mail we receive. I'm trying to make an algorithm that detects what kind of mail it is by reading through the mail and see if the characteristics belonging to the type of mail is being detected. Thats kind of the reason why I have those loops because I want to read through the whole text and I thought this was the best way of doing so. But since I literally just started last week with Power Automate I do not know the different type of methods and I would appreciate your help!

  • Matthy79 Profile Picture
    4,178 Super User 2024 Season 1 on 01 Aug 2023 at 07:10:17
    Re: Stopping a do until loop

    Hello @wqpoekqpokeq 

     

    now you are talking about emails. But why are you using move SharePoint file and ai building? Is there a different process that downloads the attached documents of an email to SharePoint? How do you manage that you know what document was sent through what email or is this information not relevant?

  • wqpoekqpokeq Profile Picture
    15 on 01 Aug 2023 at 07:34:49
    Re: Stopping a do until loop

    Nooo I mean physical mail that is being scanned by our reception. The goal now is that they can just put those scanned mails as a pdf in a sharepoint directory and with Power Automate we want to automate the detection of the type of mail and also execute other processes like changing something in our database in excel. Right now this whole process is being done manually, but since we are growing as a company it would take too much time.

  • Matthy79 Profile Picture
    4,178 Super User 2024 Season 1 on 01 Aug 2023 at 11:38:27
    Re: Stopping a do until loop

    😄

     

    Ok, understood. So basically your trigger is a scan directory on Sharepoint, after that you read the text of the new file and compare some text.

     

    you have a parallel branch. Can you explain that. Because right now I think your flow would fail if both conditions are true. What should happen in that case?

     

    I would suggest to put the whole text of the pdf into one compose action and compare it to your defined strings but you have define what should happen if more conditions are true.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 666 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 382 Moderator

#3
developerAJ Profile Picture

developerAJ 254

Last 30 days Overall leaderboard