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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Find record in array a...
Power Automate
Unanswered

Find record in array and break "apply to each"

(0) ShareShare
ReportReport
Posted on by 186

I have an array of around 300 items and want to know the position of a certain record so I can find out what my Flow is doing when it hits that record.   I can't just keep hitting "next" until I find it in the flow run history. 

 

I thought I'd create a smaller flow with a "Do until"  which has "ID" = 123432 (the id number) and increments a variable. But.. Automate insists on putting this inside an "Apply to each".  I'm fairly certain this creates a viscous loop as I had to end the run after 15minutes. 

How do I find the position of a certain Id within an array and return that number?

Categories:
I have the same question (0)
  • Verified answer
    PrasadAthalye Profile Picture
    on at

    @grantreid - You can declare a integer variable to 0 and increment within foreach using Increment variable action. Then when your id matches, you can set the value of this variable to another variable inside the match condition. Then use that variable to know the index..

     

    Like and Mark this as solution if this resolves your issue.

  • grantreid Profile Picture
    186 on at

    Yes, that would work. 

    I still find it stupid that the Apply to Each is automatically inserted into the flow.  If I have 300 items in the array and the target is found at number 14... it still has to go through 300 iterations. 

  • Verified answer
    PrasadAthalye Profile Picture
    on at

    You can use Terminate Action to Terminate the flow as soon as you find a match.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 523 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard