Practical Example
Let’s consider a practical example where you want to display the loading message when a button is clicked. You can use the UpdateContext function to manage the visibility of the dialog box.
1. Create a Button: Add a button control to your screen and set its OnSelect property to the following formula:
UpdateContext({ ShowLoader: true })
2. Create a Loader Message: Add a container control to represent the loader and set its Visible property to ShowLoader.
3. Hide the Message: Add a hide button on the loading screen (to simulate completion of the loading event) and set its OnSelect property to:
UpdateContext({ ShowLoader: false })
This setup ensures that the loader is only visible when the ShowLoader variable is true, and it can be closed by setting the variable to false.
Additional Details about Context Variables
Context variables can hold various types of information, including single values, records, tables, object references, and any result from a formula.
This flexibility allows you to use context variables for a wide range of purposes within your app.
There is no explicit declaration required of a context variable as UpdateContext handle declaration and assignation in a single operation.
If you remove all references to a context variable, it will cease to exist. To clear a variable, you can set its value to the result of the Blank function.
You can view your variables’ values, definitions, and uses with the Variables view under the File menu in the authoring environment. This feature helps you keep track of your variables and manage them effectively.