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 / pull current index fro...
Power Automate
Unanswered

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

(0) ShareShare
ReportReport
Posted on 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

Categories:
I have the same question (0)
  • Verified answer
    RezaDorrani Profile Picture
    12,143 on at

    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.

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    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

     

     

  • RezaDorrani Profile Picture
    12,143 on at

    @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,865 Most Valuable Professional on at

    Hi @RezaDorrani 

     

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

     

  • Anjan Chidige Profile Picture
    85 on at

    @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.

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard