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 / Using Loops or Switch ...
Power Automate
Unanswered

Using Loops or Switch Case

(0) ShareShare
ReportReport
Posted on by 79

Hi,

I have a situation where I need to use either loops or switch case. In this situation, I have a code that run about 100 lines, I have to repeate the 100 lines again and again depending on the number of variables I have set, so for eg, I have 3 different variables = 3 loops. And in some of the steps I have set it to run using the variables according to the sequence of loop. So, if its the second loop, I use the second variable and not the first variable to do the lines. Hope this is clear and there is a solution.

 

Thanks 🙂

I have the same question (0)
  • AS-06081019-0 Profile Picture
    1,738 Super User 2024 Season 1 on at

    Use subflows 

  • JackyGrealish Profile Picture
    79 on at

    But how to apply subflows into doing the above?

  • LogicSmith Profile Picture
    225 on at

    Create an empty list. Add each variable name to the list, with the % on either end. Now, loop through the list. In your 100 lines of code, use %MyVariableList[%LoopCounter%]% whenever you need that variable.

  • JackyGrealish Profile Picture
    79 on at

    Hi, do you mean like this?

     

    JackyGrealish_0-1657351946695.png

     

  • Gidi Profile Picture
    601 on at

    fix the variable into

    %MyVariableList[LoopCounter]%

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 959

#2
Valantis Profile Picture

Valantis 872

#3
Haque Profile Picture

Haque 589

Last 30 days Overall leaderboard