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
Deleted
Dec 10, 2017Not applicable
Hey Peter
Thanks I will read that tomorrow AM. That would mean, I am assuming that the variable needs to be initialized to the existing value of the status field when the form is loaded.
I will study it and mark this as the solution once I have it working.
Thanks I will read that tomorrow AM. That would mean, I am assuming that the variable needs to be initialized to the existing value of the status field when the form is loaded.
I will study it and mark this as the solution once I have it working.