cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
knandez05
Helper III
Helper III

Switch Equal expression with multiple values

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

5 REPLIES 5
henkenTech
Resolver II
Resolver II

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

Thank you for the response @henkenTech 


@knandez05 wrote:

Thank you for the response @henkenTech 


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

VictorIvanidze
Memorable Member
Memorable Member

Use this instead of Case:

 

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

Paulie78
Super User
Super User

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?

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,820)