cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kayleegoose
Advocate III
Advocate III

Workaround for not being able to use 'contains' in switch case instead of 'equals'

I know this has been suggested as an idea, but I don't see a workaround for this. (Which is extra frustrating because I have to do it this way because I'm using a workaround for checking multiple value checkboxes, but here we are) 

 

What I'm doing is working with calendars. Say Calendar 1, A, B, and C. I have a column on Calendar 1 called "Applies To" and the choices are A, B, and C. These are checkboxes. So when the users add something to Calendar 1, and choose A, B, or C, the workflow adds the items to whichever calendars are selected. So if someone adds an item, and chooses B, the workflow needs to add the item to Calendar B as well. 

 

Since Flow apparently can't handle looping through checkbox selections and run conditions based on the selections, my workaround is to loop through the selections and add them all to a string variable. Then I check if the variable contains B (for example), and if it does, I create the new item on B. 

 

It would be very nice to not have to do a bunch of regular If statements and could just do a switch case, but it only gives me the option to check 'equals' on the case. I need it to do 'contains'. 

 

I laid out this whole situation in case there's a better way to handle this that I'm missing, because I'm sure that I'm not the first person to try to do something like this. 

 

Thanks! 

4 REPLIES 4
kayleegoose
Advocate III
Advocate III

Want to add that the string comes back like this: 

 

{"Id":0,"Value":"A"}{"Id":1,"Value":"B"}{"Id":2,"Value":"C"}

 

I'm going to try to do some sort of substring method, but I still wish there was a simpler answer to something that really should be very basic, so I'll leave this up for thoughts. 

 

v-xida-msft
Community Support
Community Support

Hi @kayleegoose,

 

Could you please show a bit more about the Calendar 1, A, B and C that you mentioned?

Do you want to use contains operator within Switch case action in Microsoft Flow?

 

I afraid that there is mo way to use contains operator within Switch case action in Microsoft Flow currently, the Switch case action only support equals operator. If you would like this feature to be added in Microsoft Flow, please submit an idea to Flow Ideas Forum:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

More details about the usage of Switch case action, please check the following article:

https://flow.microsoft.com/en-us/blog/search-by-service/

 

In addition, you could consider take a try to add nested Conditions within your flow instead of Switch case to achieve your needs. Within Condition box, you could use Contains operator. More details about the usage of nested Conditions, please check the following article:

Nested Conditions

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Lexnnn
Helper II
Helper II

I needed to send email to users only once and not repeat their email address.

This is what I have done:

if(empty(item()?['Address']),'blank',item()?['Address'])

flow contains.JPGflow contains 2.JPG

CGallardo1
Frequent Visitor

Hi,

I had a similar probIem and I worked around it by:

Converting the string to an array (use split). In your case I think it would be the string that loops through the selections and adds them all to a string variable.  

You can then Set up an Apply to each and inside it set up your Case switch

 

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Users online (26,157)