Skip to main content

Notifications

Community site session details

Community site session details

Session Id : NnsZe6qoy3uyEyEle3svdQ
Power Automate - Building Flows
Unanswered

Switch Equal expression with multiple values

Like (0) ShareShare
ReportReport
Posted on 19 Apr 2021 21:32:08 by 146

Hello,

I am using the Switch function and have a Case that can be multiple options. What is the best expression I can use for this?

Can equal either one:

504

525 

513 

 If so, send to Value = email address

knandez05_2-1618867823092.png

Thank you in advance!

 

 

 

C

  • ozhally Profile Picture
    16 on 21 Nov 2023 at 05:34:32
    Re: Switch Equal expression with multiple values

    I solved this by using an If statement on the switch.

    Something like this;

     

    If(And(condition1,condition2), case1,

    If(And(condition1,condition3), case2,

    If(And(condition2,condition3), case3,

    case4)))

     

    Hope that helps someone,

    Cheers,

    Dan

  • Paulie78 Profile Picture
    8,407 Super User 2025 Season 1 on 20 Apr 2021 at 19:13:38
    Re: Switch Equal expression with multiple values

    I would personally use a totally different method, especially if the number of conditions is going to grow. I would make a JSON array like this:

    [
     {
     "value": "504",
     "email": "paul@paul.com"
     },
     {
     "value": "525",
     "email": "someone@somewhere.net"
     },
     {
     "value": "513",
     "email": "jim@enterprise.com"
     }
    ]

    Filter that array based on the value, and the take the email address. It's just cleaner and more scalable.

    Do you get where I am coming from?

  • VictorIvanidze Profile Picture
    12,284 on 20 Apr 2021 at 17:51:36
    Re: Switch Equal expression with multiple values

    Use this instead of Case:

     

    or(or(equals(variables('numvar'),504),equals(variables('numvar'),525)),equals(variables('numvar'),513))

  • henkenTech Profile Picture
    135 on 20 Apr 2021 at 12:47:48
    Re: Switch Equal expression with multiple values

    @knandez05 wrote:

    Thank you for the response @henkenTech 


    Please mark your question is solved if this was your solution. Thank you 😊

  • knandez05 Profile Picture
    146 on 20 Apr 2021 at 12:46:30
    Re: Switch Equal expression with multiple values

    Thank you for the response @henkenTech 

  • henkenTech Profile Picture
    135 on 19 Apr 2021 at 22:05:55
    Re: Switch Equal expression with multiple values

    Hey there - to my knowledge, Switch cases can only compare single values using "equals" as a comparator. "Contains" is not supported. 

     

    To do this, you could nest test switch case inside one of the branches of a condition. Use the "contains" comparator in the condition to catch the one case with several values and deal with the rest using the switch case.

     

    Max

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
David_MA Profile Picture

David_MA 135 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 125

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 120 Super User 2025 Season 1

Overall leaderboard
Loading started