cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
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
Highlighted
Dual Super User III
Dual Super User III

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!

Highlighted
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

Highlighted

I believe I understand everything except this part:

 

 set the component's varvalue:

Dropdown2.Selected.Value

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,325)