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
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,720)