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

switch function

Hi ,

I would to when i select on the payment method credit card the Status dropdown to select Closed please  

 

Thanks 

 

Annotation 2020-06-24 155413.pngAnnotation 2020-06-24 1554132.png

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Ramole ,

 

Try this:

If(dropdowncontrol.selected.value = "Check" || dropdowncontrol.selected.value = "Credit Card",updateContext({varSelStatus:"Closed"}),updateContext({varSelStatus:"Open"}))

Now set the variable in the status dropdown for default selected Items property as below:

{value:varSelStatus}


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

7 REPLIES 7
Resolver I
Resolver I

Not trying to be difficut, but have you checked out the documentation here?

Hi @cchannon 

I Try but I am  confused can you please help me on this one 

 

Thanks

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.

Sure. OK, so you have two functions you might choose between here, and since you opened the post asking for Switch I'm gonna guess you already know that is the one you want to use, so we will just talk about Switch and not If...

The advantage of using Switch over If is that you can write your condition criteria once, then apply it over many evaluation possibilities, instead of having to write If(<condition>, <outcome>) for every single one.

So the Switch function has the following syntax: Switch(<formula>, Match1, Result1, Match2, Result2..., MatchN, ResultN)
You can add as many possible matches and corresponding results as you want (but unlike C# and other language implementations of Switch you have no break operator so you will have to call out one result for one match every time).

So let's try an example. Say we have a text input where a user types in another user's name and we want to control outcomes based on whose name they type in. Say the text field is called "UserName". If they enter CChannon, we then output True. Otherwise, if they enter Ramole, we output False. That Switch statement would look like this: 

Switch(UserName.Text, "CChannon", True, "Ramole", False)

We could keep going with this for as many possible conditions as we want to evaluate, so say instead of True/False we want to associate a number with each username, we might write: 

Switch(USerName.Text, "CChannon", 1, "Ramole", 2, "UserX", 3, "UserY", 4)

 

Does that help?

Super User III
Super User III

Hi @Ramole ,

 

try this: Set it onChange of the Payment Method Dropdown

Switch(paymentmethoddropdown.Selected.Text, "Credit Card", UpdateContext({varStVal:"Closed"}), "Debit Card", UpdateContext({varStVal:"Open"}))

 Now Set the variable varStVal as default value for status dropdown control.

 


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

Hi 

Always getting error i dont know why , let me tell you what i am looking, example when payment method dropdown selected "Credit Card" and "Check"  The Status Dropdown = "Closed" and the rest should show "Open"

 

Thanks

 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.
Post Prodigy
Post Prodigy

Hi 

 

Is there anyone can help on this please how can make when user select dropdown payment method credit card, the pther dropdown status to auto select CLOSED 

 

Thanks 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.

Hi @Ramole ,

 

Try this:

If(dropdowncontrol.selected.value = "Check" || dropdowncontrol.selected.value = "Credit Card",updateContext({varSelStatus:"Closed"}),updateContext({varSelStatus:"Open"}))

Now set the variable in the status dropdown for default selected Items property as below:

{value:varSelStatus}


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (10,012)