Forum Discussion
Deleted
Dec 10, 2017Not applicable
How to Update a Field through a button's OnSelect Event
I've watched quite a few PowerApps videos this weekend and feel I have enough knowledge to try my hand at customizing some forms this coming week. However, something very basic escapes me and I didn'...
Peter McDonald
Dec 10, 2017Brass Contributor
You would need to set the value of the field you want to change to a variable and then set that variable with the OnSelect event.
Depending if you need this across multiple pages you can use either a local (context) or global variable.
To set a local variable you can use UpdateContext( { ContextVariable1: Value1 } ) or like these 2 examples: UpdateContext( { CountNumber: 1 } ) or UpdateContext( { Name: "John"} )
To set a global variable you can use Set( VariableName, Value ) or like these 2 examples: Set( CountNumber, 1 ) or Set( Name, "John" )
To use show either of the above variable types is as easy as putting the variable name in the text property of the object you want to use.
See these pages for more:
https://docs.microsoft.com/en-us/powerapps/functions/function-updatecontext
https://docs.microsoft.com/en-us/powerapps/functions/function-set
Pınar Rehber
Apr 22, 2018Copper Contributor
Hi,
How can we change a column value to variable?
I have and dislike columns in my excel.
When the user clicks the Like button under the image I want the column value to be increased by 1, same for dislike button.
Also for each image if the user clicked Like button she/he shouldnt be able to click dislike button and viceversa.
How can I do this?
Thanks,