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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / LoopIndex goes back to...
Power Automate
Answered

LoopIndex goes back to '0'

(0) ShareShare
ReportReport
Posted on by 25

Hello everyone, 

 

I'm stuck in a loop I'm building. I think it's something very small I'm overlooking, but I can't find the answer anywhere online either. Hopefully you can help with this.

 

The loop starts on a page with multiple links, he opens the first link(0) to another page. This page contains certain information that he is going to compare with conditions in the loop (multiple if and else if statements).


If it finds certain information, the LoopIndex is increased by 1, with other information by 0.
This goes well at first, you can also see that the LoopIndex is being increased in the variable screen. The last step is that he goes back to the first page and opens another link here, but with the new loop index.

 

The problem is that as soon as the loop starts again, the LoopIndex is reset to 0, so it opens the first link again. 

 

I will add pictures of the loop, the selector of the link and the variables screen.

 

Schermafbeelding 2023-06-05 141809.jpg

 

Schermafbeelding 2023-06-05 141603.jpg

 

Schermafbeelding 2023-06-05 141803.jpg

I have the same question (0)
  • OkanMTL Profile Picture
    703 Super User 2024 Season 1 on at

    Hi,

     

    So this loop won't work past the first loop because you 're incrementen loopindex with loopindex... Look at it this way, when the loopindex is as say for example 3 (if it had 3 succesful runs), the next loop will start at 7.
    3+ loopindex (which is 3 at the time) + 1 (your if else statements) and after that it will be 15.... Change 'met stap' variable to something like: AppendingNumber or what you like.

     

    And btw, if the loopindex increases with 0 (the Else if statement), the loop is gonna stay stuck.

     

    Maybe try fixing these things and try again?

  • Petra_91 Profile Picture
    25 on at

    Thanks for the response! 

     

    Yes this increasing with loopindex was just a thing i tried last and didn't remove. 

     

    What do you mean with AppendingNumber?

     

    The reason that under certain circumstances the loop goes up by 0 is because in this case something in the webpage is going to be changed, so that this page is no longer in the list of links, so it must open the same number as the time before.

     

    The problem now is that it does not continue to the next link, even though the index is increased by 1, but always goes back to 0. How can I solve this?

  • OkanMTL Profile Picture
    703 Super User 2024 Season 1 on at

    Is the loopindex still at 1 at the end of the flow? You can check this by adding a breakpoint before the last step. 

  • Srini007 Profile Picture
    3,490 Super User 2026 Season 1 on at

    Hi @OkanAT 

     

    So you have placed the conditions based upon the AttributeValue2, Now the value is Verzonden that's why you set the loop index as 1 and end the loop?

     

    But here where is the increment? because you set the Index as 1 and after that I don't see any increment for the Index

     

    If you find this reply helpful, please consider giving it a LIKE AND

    If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION

     

  • Petra_91 Profile Picture
    25 on at

    Apparently i did something wrong the first time i tried using a new variable, the way i use it now it works. But now you made me worry about the increasing thing... 

     

    When it's at 3 it shouldn't increase with 4 like you explained.

     

    Schermafbeelding 2023-06-05 153200.jpg

     

    Schermafbeelding 2023-06-05 153221.jpg

  • Verified answer
    OkanMTL Profile Picture
    703 Super User 2024 Season 1 on at

    Since you use new Var that won't happen anymore. 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 276 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 169

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard