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

Changing the value in choice dropdown in a control when toggle control switched.

Hi

Any advise appreciated My scenario When the Manager completed (DataCardValue41) field is toggle to on (true) then change the dropdown value of ef3 Status value (datacardvalue42) to manager

 

I Assume on the datacardvalue41  oncheck is where I put the if statement, but its updating the ef3 status that I still have to get my head around 

 

Capture.PNG

7 REPLIES 7
TimRohr
Solution Sage
Solution Sage

Hi, @sbonera ...

Put your statement in the DataCardValue42 DefaultSelectedItems statement...

 

If(DataCardValue41.Value, First(Filter(your_ef3_DataSource, yourDisplayField = "Manager")))

 

Your syntax might change slightly if you're working with SharePoint lists... but the above will put "Manager" into the control when you toggle the control. If the control is toggled to "OFF", the field will clear because there is no ELSE case provided. You can use that portion of the statement if you need to extend this functionality.

Thanks that makes sense, the dropdown control is indeed a sharepoint choices field, there is no defaultselecteditems for that such control?

Anonymous
Not applicable

Hi @sbonera 

 

You can put the Default property of your Dropdown on

Dropdown2Default

and then put your OnCheck property to :

UpdateContext({Dropdown2Default:"MANAGER"});;
Reset(Dropdown)

Hope that will help you 🙂

 

Best regards

 

Louis

The property is there regardless of your datasource. You can find it in the upper left list of all properties, or if you go to the Advanced pane (on the right), find the "DATA" section of properties, and then click on the "More Options" button.

 

To be fair, @Anonymous 's suggestion of using a context variable is an absolutely viable way to accomplish the same effect... and one that I use probably 3 out of 4 times when this sort of thing comes up.

Anonymous
Not applicable

Hi @TimRohr ,

 

When I posted the reply, I didn't see there were already replies.

I didn't think about that... It's a good way too (I found the simpliest soluce eheh...)

I'll try it

 

Regards

 

Louis

thanks both 

@Anonymous 

Not sure I quite understand the first part of your answer.  What do you mean by Dropdown2Default  my dropdown is currently called datacardvalue42

 

The dropdown box is a SharePoint, so does this change anything, i am going to test by adding a combo box from controls and try your context varible

Anonymous
Not applicable

@sbonera ,

 

Dropdown2Default  isn't a control, it's a variable with the value "MANAGER".

I just love variables but honestly you can just do it without UpdateContext.

You can put the Default statement of DatacardValue42 on "MANAGER", and your OnCheck statement of DatacardValue41 on Reset(DatacardValue42)

 

It's really short but it works. The problem is that each time you'll go on your app, "MANAGER" value will be selected by default.

 

Louis

Helpful resources

Announcements
PA 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

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

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

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (80,701)