cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper V
Helper V

How to use a dropdown in a component to control a variable

We have a dropdown in a component menu, that lists the name of buildings a user may choose from.  When a person chooses one it is to change the app BUILDING variable.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @Humanity ,

Do you want to use a drop down inside a component to change a global variable?

That means: you need to use control inside component to trigger an action.

However, the point is: it's not supported to customize behavior property of component.

The solution is to use toggle to trigger the action of setting variable.

However, toggle's value could only be true or false. So you could use toggle to do this only when you want BUILDING variable has two value, more is not supported.

I've made a similar test for your reference:

 

1)drop down inside the componnet:

Items:

[1,2,3,4]

2)create a custom output variable of the component like this:

7201.PNG

 set the component's varvalue:

Dropdown2.Selected.Value

 

2)outside the component, inside the app

insert this component and insert a toggle

set the toggle's Default:

If(Component1_1.varvalue=1||Component1_1.varvalue=2,true,false)

set the toggle's OnCheck:

Set(BUILDING,"value1")

 set the toggle's OnUncheck:

Set(BUILDING,"value2")

set the toggle's Visible:

false

 

Then if you choose 1or2 in that drop down, the toggle will be true and you will set BUILDING to value1.

If you choose 3or4 in that drop down, the toggle will be true and you will set BUILDING to value2.

 

What's more, if you want to set BUILDING to more than two values, I suggest you put that drop down outside the component.

Except using toggle, I'm afraid there's no better way to use control inside component to trigger action.

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Dual Super User II
Dual Super User II

Hi @Humanity 

 

Can you try to update the OnChange property of the dropdown control to:

Set(BUILDING, DropdownName.Selected.ColumnName)

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Community Support
Community Support

Hi @Humanity ,

Do you want to use a drop down inside a component to change a global variable?

That means: you need to use control inside component to trigger an action.

However, the point is: it's not supported to customize behavior property of component.

The solution is to use toggle to trigger the action of setting variable.

However, toggle's value could only be true or false. So you could use toggle to do this only when you want BUILDING variable has two value, more is not supported.

I've made a similar test for your reference:

 

1)drop down inside the componnet:

Items:

[1,2,3,4]

2)create a custom output variable of the component like this:

7201.PNG

 set the component's varvalue:

Dropdown2.Selected.Value

 

2)outside the component, inside the app

insert this component and insert a toggle

set the toggle's Default:

If(Component1_1.varvalue=1||Component1_1.varvalue=2,true,false)

set the toggle's OnCheck:

Set(BUILDING,"value1")

 set the toggle's OnUncheck:

Set(BUILDING,"value2")

set the toggle's Visible:

false

 

Then if you choose 1or2 in that drop down, the toggle will be true and you will set BUILDING to value1.

If you choose 3or4 in that drop down, the toggle will be true and you will set BUILDING to value2.

 

What's more, if you want to set BUILDING to more than two values, I suggest you put that drop down outside the component.

Except using toggle, I'm afraid there's no better way to use control inside component to trigger action.

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

I believe I understand everything except this part:

 

 set the component's varvalue:

Dropdown2.Selected.Value

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 (4,248)