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 / 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
    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

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard