cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
troyrowlands
Frequent Visitor

Change dropdown default selected value based on a toggle control

I have a dropdown from a SharePoint list with two items in it. "Normal Time" and "Overtime". I have a toggle switch which i want to control the dropdown selection toggle between normal time and overtime. I am using the toggle switch as I need more space and do nopt want the dropdown showing on the form.

 

It works when creating a new form using the default on the dropdown data card as:

 

If(Overtimetoggle.Value=true;If(SharePointForm1.Mode=New;LookUp(Choices('Call Log 2019/2020'.'Time Type');Value="Overtime");ThisItem.'Time Type');If(SharePointForm1.Mode=New;LookUp(Choices('Call Log 2019/2020'.'Time Type');Value="Normal Time");ThisItem.'Time Type'))

 

But i am battling to get it to now work when the form is edited and the toggle is changed.

 

My thinking is to do something on the toggle OnChange trigger, which will update the default on the dropdown datacard default, but can not get this to work or maybe the syntax correct....any help appreciated or if I should be using a different method then let me know.

 

OnChange ----> (My thoughts)

 

If(SharePointForm1.Mode=Edit And Overtimetoggle.Value = true;'Time Type_DataCard1'.Default =LookUp(Choices('Call Log 2019/2020'.'Time Type');Value="Overtime");'Time Type_DataCard1'.Default=LookUp(Choices('Call Log 2019/2020'.'Time Type');Value="Normal Time"))

1 REPLY 1
Drrickryp
Super User
Super User

Hi @troyrowlands 

I think you are making this much more complicated than it needs to be.  First hide the combobox inside the card. If you want to enter either "Overtime" or "Normal Time" in a form, set the toggle properties as follows:

Default  If(Parent.Default="Normal Time", true, false)

TrueText "Normal Time"

FalseText "Overtime"

Set the Update property of the card to 

If(Toggle1.Value = true,"Normal Time","OverTime")

 

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,598)