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.
Solved! Go to Solution.
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:
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,
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!
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:
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,
I believe I understand everything except this part:
set the component's varvalue:
Dropdown2.Selected.Value
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
196 | |
175 | |
62 | |
34 | |
32 |
User | Count |
---|---|
341 | |
271 | |
110 | |
76 | |
59 |