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 / How to take the LoopIn...
Power Automate
Unanswered

How to take the LoopIndex obtained through Loop, input it into cb#, obtain the variable content

(0) ShareShare
ReportReport
Posted on by 12

i have variables(cb1、cb2、cb3、cb4......) ,How to take the LoopIndex obtained through Loop, input it into cb#, obtain the variable content (cb1, cb2, cb3, cb4, ...), and write the variable content into an Excel file?

I have the same question (0)
  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @ksdpm ,

     

    Please try this

    vxiaochenmsft_0-1692241217423.png

    vxiaochenmsft_1-1692241228080.png

    vxiaochenmsft_2-1692241251790.png

    vxiaochenmsft_3-1692241263337.png

     

    Best Regards,

    Wearsky

  • ksdpm Profile Picture
    12 on at

    sorrry, i use pad.
    if you know how to do,please tell me.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    PAD does not support dynamic variable references.

    What I would suggest, though, is that you put your variables into a list by using Set variable and setting the value to %[cb1,cb2,cb3,cb4,...]% and then accessing those values via a loop index. Note that list indexing is 0-based though, so your first item will be at index 0.

     

    Alternatively, you could also put them all into an object by using Convert JSON to custom object and converting the following JSON:

    {
     "cb1": "%cb1%",
     "cb2": "%cb2%",
     "cb3": "%cb3%",
     "cb4": "%cb4%",
     ...
    }

     

    When you have that, you can access your values as %JsonAsCustomObject['cb1']% (assuming your object is stored in %JsonAsCustomObject%). So, if you have a loop index with a value of 1, you could have a separate variable, called, for example, %Property% and use Set variable to set it to cb%LoopIndex%. Doing so will result in the %Property% variable storing the reference to the item you need. You can then use %JsonAsCustomObject[Property]% to access the item inside the loop.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 247 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 164 Super User 2026 Season 2

#3
trice602 Profile Picture

trice602 138 Super User 2026 Season 2

Last 30 days Overall leaderboard