cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TheMaster
New Member

Set dropdown selected item to match that of a Label

Hi there,

 

I have a dropdown (NOT a ComboBox) with Default: ddDefaultValue

 

I also have OnVisible: UpdateContext({ddDefaultValue: "No Multiplier"}) - this sets the dropdown to "No Multiplier" - my chosen default value for this dropdown upon opening the app.

 

I want to create a button that looks at the value of Label1 (a text label) and enters this into the dropdown.

 

I've tried creating a button with OnSelect: UpdateContext({ddDefaultValue: Label1.text}) but this does not work and simply clears the dropdown - does anyone have any ideas please?

 

Many thanks 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
rubin_boer
Super User
Super User

hi @TheMaster 

 

Consider the following:

  • Items which the source the dropdown will display
  • Default as the first item to display
  • Another value to set to default, is a value present in the Item source

 

OnVisible

Set(varData,["No Multiplier", "Your Value of Label1", "Another Vlaue"]);

UpdateContext({_defaultData: "No Multiplier"})

 

Button

OnSelect = UpdateContext({_defaultData: Label1.Text})

 

This will set you default value to the label text. if the label's text is not in the source (Item) it will revert to the first item.

 

PS what is you Items set to and what is the value of the label?

 

I hope this helps,

R

 

 

hey there if you liked the post give it a thumbs up, and if it solved your question please accept it as a solution.

View solution in original post

1 REPLY 1
rubin_boer
Super User
Super User

hi @TheMaster 

 

Consider the following:

  • Items which the source the dropdown will display
  • Default as the first item to display
  • Another value to set to default, is a value present in the Item source

 

OnVisible

Set(varData,["No Multiplier", "Your Value of Label1", "Another Vlaue"]);

UpdateContext({_defaultData: "No Multiplier"})

 

Button

OnSelect = UpdateContext({_defaultData: Label1.Text})

 

This will set you default value to the label text. if the label's text is not in the source (Item) it will revert to the first item.

 

PS what is you Items set to and what is the value of the label?

 

I hope this helps,

R

 

 

hey there if you liked the post give it a thumbs up, and if it solved your question please accept it as a solution.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,092)