cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Davidx23
Helper I
Helper I

For Each - INCREASE CurrentItem variable without reaching END step

Good day Everyone,

 

First, is this possible?

 

I'm trying to update something and i wanna do it through PA, everything is perfect just one step away from heaven.

 

The CurrentItem does not increase because it doesn't reach the END action because i placed a 'EXIT LOOP' right behind it. Is it possible to increase? or there's another way to make it without using foreach?

 

Capture.PNG

 

Please help.

1 ACCEPTED SOLUTION

Accepted Solutions
Davidx23
Helper I
Helper I

Guys,

 

I did find the solution by my own, just rebuilt the flow and make the consult in a Store Procedure by its row's ID, updated the same way and that was bbq chicken.

 

Thanks anyway and i'll share the flow if may be helpful for someone else.

 

Capture.PNG

View solution in original post

7 REPLIES 7
UK_Mike
Post Prodigy
Post Prodigy

Remove the " exit loop " surely ? then it will iterate through list...

Davidx23
Helper I
Helper I

UK_Mike

 

Thing is i need to match the ID value with the CurrentItem Value in order to update it in DB.

Well ive no idea about Sql but that flow is doing exactly what you said to do, Exit the loop after 1 iteration.

You could try a regular loop, specify the times to loop or loop to the List.count...

MichaelAnnis
Super User
Super User

Are you saying Exit Loop is taking it out of both loops, and not just the second Loop?

MichaelAnnis
Super User
Super User

Next takes is to the Next iteration, but End naturally does the same thing.

Example:

 

For each

'Do something

Next

End

 

For Each

'Do something

End

 

They are the same thing.  Next is typically used when you are trying to skip the rest of the steps in the loop based on a conditional statement.

Ex.

For each

If %CurrentItem.Name% = John

    Next

End (if)

'Do something (will only occur if %CurrentItem.Name% is not John)

End (for each)

 

Exit Loop cancels out a loop completely, so as I read it, you are telling it to only iterate once on the second loop, because you are telling it every time to exit this loop.

Just had a second glance at the screenshot, If theres only 1 file in the current item it would end anyway...🤔

Davidx23
Helper I
Helper I

Guys,

 

I did find the solution by my own, just rebuilt the flow and make the consult in a Store Procedure by its row's ID, updated the same way and that was bbq chicken.

 

Thanks anyway and i'll share the flow if may be helpful for someone else.

 

Capture.PNG

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

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