Skip to main content
Community site session details

Community site session details

Session Id : xskueCoBeteet+y4QX+K30
Power Automate - Building Flows
Answered

pull current index from the current apply to each for an array

Like (0) ShareShare
ReportReport
Posted on 17 Feb 2020 18:05:20 by

Ok, so I'm passing an array in of emails to an apply to each. there is a correlated answer field in a SharePoint list that is correlated to each email by where they are in the array.

EX:

Array[1] = "Dudebro@gmail.com"

Answer_1 = "dudebro's answer"

 

so what I'm trying to do in the apply to each is find what the current index is and do something like

"Answer_" + Index

  • Anjan Chidige Profile Picture
    85 on 25 Jun 2024 at 12:35:03
    Re: pull current index from the current apply to each for an array

    @RezaDorrani , I am using Apply To Each action and the concurrency is set to 10. I am using a Index variable and incrementing it to find out the current iteration value. In the loop, I have a condition when the Index variable value is 5, display the value in Compose. But due to the concurrency value, the loop iteration is at 40 when the index variable value is 5. which is not useful. I waned to get Loop Iteration value i.e. 40.

     

    Please suggest, how to get the Loop Iteration value i.e. 40 when concurrency setting is on.

  • abm abm Profile Picture
    32,506 Most Valuable Professional on 17 Feb 2020 at 19:57:52
    Re: pull current index from the current apply to each for an array

    Hi @RezaDorrani 

     

    Just tried it and worked as expected. Thanks for your prompt response.

     

  • RezaDorrani Profile Picture
    12,141 on 17 Feb 2020 at 18:46:18
    Re: pull current index from the current apply to each for an array

    @abm 

     

    Documentation for iterationindexes states it only works in do until loops

    So the apply to each loop will have to be changed to a do until loop to get the index

     

    If you need in a apply to each loop, then one would have to create a variable and increment within the loop

     

    --------------------------------------------------------------------------------
    If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

  • abm abm Profile Picture
    32,506 Most Valuable Professional on 17 Feb 2020 at 18:28:45
    Re: pull current index from the current apply to each for an array

    Hi @RezaDorrani 

     

    I was trying this expression earlier and couldn't figure out how to use it. Would it be possible to add an example specific to iterationIndexes? 

     

    This is what I tried.

     

    image.png

     

    Expression above I used is 

     

    iterationIndexes(items('Apply_to_each'))

     

    Thanks

     

     

  • Verified answer
    RezaDorrani Profile Picture
    12,141 on 17 Feb 2020 at 18:19:12
    Re: pull current index from the current apply to each for an array

    Hi @Anonymous 

     

    IterationIndexes will provide you the current index of the for loop

    https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#iterationIndexes

     

    --------------------------------------------------------------------------------
    If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2