cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MH3
Post Prodigy
Post Prodigy

Flow Switch Condition Case With Two Values

Hi,

 

Hope you are doing well.

 

I have a application which have multiple leave types, I want to Start and Approval Action depending upon the leave type which is created.

 

So, I have used a Switch Case Condition.

 

But I want to create two cases only, One for Time Off and Another for Annual, Casual and Sick Leave.

The Switch Case has only one condition value, *Equals: (Can we type like this >> Annual Leave || Casual Leave).


flowCase.jpg

because I want to make two cases and depending on them, I want to start and Approval process.


 Any Help??

1 ACCEPTED SOLUTION

Accepted Solutions

@MH3 


Initialize variable with empty value. And then in the condition check for the power apps input option for the type of leave and then set the variable accordingly. After that, check the variable in the switch case condition. 

 

Actually, if you are using the condition, you can check for the type of leave and then directly add the approval in the condition branches without using the switch control. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

6 REPLIES 6

Hi @MH3 

 

A switch case can have only one value to compare the result with. So you can either replicate for all the same options or initialize a variable action and then add a condition to set this variable value as one of the two values based on the inputs and then do the switch on the variable value. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hi @yashag2255 ,

 

I am actually confused, when I select Time Off in PowerApps, only TimeOff related fields are patched into the SP list.

 

and if the user selects Annual, Sick or Casual, They have same column names which are patched into SP List.

 

So, how can I set the variable with two values as a String? Like this Initialize Variable >>> ( Type = String, Value = Annual Leave || Casual Leave).

 

When the item is created it will save the leave type also in SP list. I have to set the Start and Approval Action Details differently for (Time off) and (Annual,Sick and Casual).
 Can you please show me via screenshot.

Thanks

@MH3 

 

You can try something like this: 

 

yashag2255_0-1599476828039.png

 

Replace the compose outputs from the condition to the values that need to be compared from the dynamic selector. 

 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

well, I still didn't got your point sorry.

 

but do I have to initialize a variable? with two values 1 for Time off and another for Annual || Causal || Sick ?

 

 

@MH3 


Initialize variable with empty value. And then in the condition check for the power apps input option for the type of leave and then set the variable accordingly. After that, check the variable in the switch case condition. 

 

Actually, if you are using the condition, you can check for the type of leave and then directly add the approval in the condition branches without using the switch control. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Yes, I did that

@yashag2255 

Let me show you my flow

Flow Pic 1

Flow 1Flow 1

Flow pic 2
Flow 2Flow 2


Flow Pic 3

Flow 3Flow 3


Flow  Pic 4
Flow 4Flow 4

Right Now, this is my Flow, in Flow pic 1 I have used 1 approval and in the details I have inserted all the fields, the fields are empty when the record was created will show empty and those who have data will show the data.

So, the problem is I have to show some title against these values.

If I write,

Time Off Date: Sp Column Value(TimeOffDate)

 

it will only show Time Off Date: because the SP column value of time off date will be empty, if the user created record for Annual Leave.

 

Same goes to the other leave type.

 

Annual, Casual and Sick Leave have same titles and Sp column names, while TimeOff has different titles and SP Column Names.

How can, I fix this with your approach

 

Help!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (2,557)