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 / Looping and reading fr...
Power Automate
Answered

Looping and reading from list

(0) ShareShare
ReportReport
Posted on by 72

Have a PAD process that I am looping through records on a web site and pulling out a value out of one of the columns in this case its an Agreed Rate. I then have an Excel file where I am using an "Read from Excel" action to get available rates out of up to 4 columns and storing those in Rate1 - 4 variables. I would think there has to be a way that I can build a list of the potential 4 available values and then just see if my Agreed Rate matches one of the Excel values, but I haven't been able to find it yet and have resorted to complex if statements and that just doesn't seem necessary. Any guidance would be greatly appreciated. 

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Does your remaining flow change based on which rate (1-4) it is?

    If so, you want a 'Switch -> Case' scenario.  A SWITCH looks at a variable and compares it against different options and chooses the path based on the option (like a decision fork on a process diagram).  It looks like this:

    MichaelAnnis_0-1691549105162.png

    Here is the code for the SWITCH -> CASE, if it helps:

    SWITCH ActualRate
    CASE = Rate1
    # perform remaining flow for Rate1
    CASE = Rate2
    # perform remaining flow for Rate2
    CASE = Rate3
    # perform remaining flow for Rate3
    CASE = Rate4
    # perform remaining flow for Rate4
    DEFAULT
    EXIT Code: 0 ErrorMessage: $'''Actual Rate does not equal optional rates'''
    END

    Best of luck!



  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    If you just need to know if it matches one of them simply as a validation check, I would "Read from Excel" to a List (assuming the 4 are together) or if not, you could combine to a list after they are read.

    Once you have them in a list, you could say If %List% does not contain %ActualRate%, throw error.

    If you don't like that option, you could do something like this.  It checks each one and moves to the Label down at the bottom, but if it doesn't find a match, then stops at the "stop flow" (which could also move to a different exception flow if you would like):

    MichaelAnnis_1-1691549900630.png


    Here is the code for this example:
    IF ActualRate = Rate1 THEN
    GOTO 'Continue Flow'
    END
    IF ActualRate = Rate2 THEN
    GOTO 'Continue Flow'
    END
    IF ActualRate = Rate3 THEN
    GOTO 'Continue Flow'
    END
    IF ActualRate = Rate4 THEN
    GOTO 'Continue Flow'
    END
    EXIT Code: 0 ErrorMessage: $'''The Actual Rate doesn\'t match the available rates'''
    LABEL 'Continue Flow'

    Best of luck!





  • lkhall_37203 Profile Picture
    72 on at

    Thank you for the reply I had in mind "read from excel" to a list but wasn't sure how it would handle blank values in the spreadsheet. You can see from the screen shot that the list could contain anywhere between 1 and 4 values and as long as the rate matches 1 of these it should just exit the loop and continue on else proceeded to workflow. I am going to mess around with your various options this morning and see what happens. 

     

    lkhall_37203_0-1691584091517.png

     

  • lkhall_37203 Profile Picture
    72 on at

    I think I might have found an easy solution that you actually posted in another thread. Using an if statement to check if the preferred rate = rate 1 and if so, just use a "Next Loop" to exit the flow and go back into the loop. Do this for each check of the preferred rate and put other workflow below the if blocks in case there is not a match. 

     

    lkhall_37203_0-1691585879419.png

     

    lkhall_37203_1-1691585994603.png

     

     

  • Verified answer
    MichaelAnnis Profile Picture
    5,727 Moderator on at

    Yeah, so if you just want it to stop that loop and go to the next loop, you could probably use that same logic that you have above, but say if %RateList% contains %ActualRate%, next loop.

    Just to get it down to one action; otherwise, what you have should work.

    Happy Automating!

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 227 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 221 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 132

Last 30 days Overall leaderboard