Video:
Info:
Scope: the context in which something is used. For example, the scope of my living room TV is that it is only used in the Living Room.
Global Variables:
Set with Set(_var, value)
— the scope is that it can be used across all screens in an app.
Context Variables:
Set with UpdateContext({__var: value})
— these can only be used within a single screen at a time.
Tip: To avoid confusion between Global and Context variables, use naming prefixes. I prefer _ for Global and __ for Context variables.
Data Types:
For now, we will focus on two data types: Number and Text. (There are others.)
You can convert between them using these functions:
Text to Number:
Value(textValue)
This will convert a text string like '123' into the number 123. Keep in mind that this only works if the text represents a valid number. For example, 'one' will not convert to 1.
Number to Text:
Text(numberValue)
`
This will convert a number like 123 into the string '123'. This function works on any number.
Context and Global variables in Power Apps