cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

Passing a multiple choice through a switch case condition

Hi all,

 

I'm using a form whereby a user would be able to deliver communications. The possibility is that issues could affect multiple regions and so within the form i ask this;

 

Multiple choice regions.png

 

Within my Flow, the user must specify 'Initial' 'Ongoing' or 'Resolved' which then should determine which style of email is used, it should then deliver comms to the appropriate group or groups (as multiple can be selected).

 

Multiple choice switch case.png

 

As shown, the Output from the Form contains multiple entries and because the Switch case selection specifies 'equals', it doesn't meet the criteria to send out the emails for UK Sports, UK News & Germany from the ongoing flows set below.

 

Could anyone help?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi,

 

After thinking about it for a while, i realised that i'd been using the wrong style function whereby a 'Switch Case' should be used where the Output is singular. I've instead made use of multiple 'conditions' all set to run in parrallell and each check for the one of the multiple options (UK Sport, UK News etc..)that can be selected;2018-06-12 22_36_20-Edit your flow _ Microsoft Flow.png2018-06-12 22_39_41-Edit your flow _ Microsoft Flow.png

 

 

at this point i use a 'switch' case to determine whether the style should be Initial, Ongoing or Resolved (something that will always be a single output) & the Send email function within each potential output2018-06-12 22_47_25-Edit your flow _ Microsoft Flow.png

 

 

 

 

 

The flow seems to work as intended, open to any suggestions though!

 

Hopefully this helps someone else down the line 🙂

 

Thanks!

View solution in original post

7 REPLIES 7
Highlighted
Advocate I
Advocate I

@v-yuazh-msft Would you be able to help?

 

I can see in a similar style 'Idea' Stephen has suggested something that could be used, however i'm not sure how to make use of this?

 

Re: Switch Case 'contains' - Status changed to: Declined

Highlighted
Community Support
Community Support

Hi @Yacob_hard,

 

Do you want the email would be sent to all selected regions if mutiple regions are selected in the form response.

 

As is shown in the link you provided, the capability to use 'contains' and not just 'equals' with Switch Case is not supported in microsoft flow currently, you could vote for the ideal so the function might be considered for future releases. 

 

The suggestion that Stephen gived is use if() expression in the "On" field of Switch to check if the variable and give an out put.

 

You could refer to link below to learn more about the if() expression:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#i...

 

I think the easier way to achieve your needs would be add mutiple case in the Switch to contain every possibility of the answer of the "Which regions are affected by this" question.

 

Such as if could add a case with expression equal to Capture.PNG,so if the UK Sports,UK News and Germany are all selected for the "Which regions are affected by this" question, then the email would be sent to UK Sports,UK News and Germany.

 

 

 

Please let me know if your problem could be solved.

 

Best regards,

Alice

Highlighted

Hi @v-yuazh-msft,

 

Yes, the intention is that if multiple affected regions are selected, the mail is sent to each.

 

I'd be keen to understand how i could build out these If() statements for this particular workflow.

 

The workaround of adding multiple switch cases with all the variations on what could be returned seems like a less than ideal way to manage this.

 

For example if UK Sports represents 'A' UK News represents 'B' and Germany represents 'C', i've also another 2 possible selections which we'll call 'D' and 'E'. To account for these in switch cases i'd need to have a huge selection of switch cases;

 

A | AB | AC | AD | AE | ABC | ABD | ABE | ACD | ACE | ADE | 

 

And this is only for items that would contain A, replicate something similar for B,C,D & E and this method grows exponentially, not to mention the work that would be required if any of these selections were to change or additonal entries needed to be added to the form.

 

Would making use of 'Filter Array' data operations be a viable alternative to this?

 

Thanks,

Jake

Highlighted

Hi,

 

After thinking about it for a while, i realised that i'd been using the wrong style function whereby a 'Switch Case' should be used where the Output is singular. I've instead made use of multiple 'conditions' all set to run in parrallell and each check for the one of the multiple options (UK Sport, UK News etc..)that can be selected;2018-06-12 22_36_20-Edit your flow _ Microsoft Flow.png2018-06-12 22_39_41-Edit your flow _ Microsoft Flow.png

 

 

at this point i use a 'switch' case to determine whether the style should be Initial, Ongoing or Resolved (something that will always be a single output) & the Send email function within each potential output2018-06-12 22_47_25-Edit your flow _ Microsoft Flow.png

 

 

 

 

 

The flow seems to work as intended, open to any suggestions though!

 

Hopefully this helps someone else down the line 🙂

 

Thanks!

View solution in original post

Highlighted

Hello @Yacob_hard,

I have been searching for a flow exactly like what you set up! But I can't figure out how to run multiple conditions in parrallell like you pictured. Could you step me through that?

Much appreciated!

Jessica

Highlighted

Hi @jw_work,

 

This should help and is in a much better state than i would be able to document;

 

https://flow.microsoft.com/en-us/blog/parallel-actions/

 

At the 2nd picture, i've used 'Add a condition' which then allows me to check for a piece of text from my microsoft form and to run mutiple different conditions if appropriate.

 

Hope that helps 🙂

Highlighted

Thank you very much!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (9,786)