Context variables are variables that store data that can be accessed and modified by different screens and components in app. When you create a context variable, we give it a name and a default value, which can be set to any data type such as text, numbers, or arrays.
To create a context variable in Canvas app, we can follow these steps:
- Open your Canvas app in Power Apps Studio.
- Click on the “View” tab at the top of the screen.
- Click on “Variables” in the ribbon to open the variables pane.
- Click on the “New variable” button and select “Context” from the dropdown menu.
- Give your context variable a name and a default value.
- Click “Create” to create the context variable.
Once we have created a context variable, we can use it in different screens and components within app. To use a context variable, we can simply refer to it by name, and its value will be available for use. we can also modify the value of a context variable from any screen or component, and the updated value will be available to all other screens and components that use the same context variable.