Global Variables
About this task
Simplify app modifications by substituting hardcoded values with global variables in locations where you reuse the same values. You can assign a default value to a global variable and then reference the variable in locations throughout your SOTI Snap app, for example, when defining conditions in Visibility or Requirement rules. You can also use global variables in Blockly. When you change the value of the variable, you edit it in one place, and it updates everywhere.
You can configure Global variables per-app. You must create new global variables for each app.
Procedure
-
In the Canvas, open Data Connection
Rules. Move to the Global Variables
tab.
-
From the Global Variables
tab, you can perform the following
tasks:
Task Procedure Adding a Global Variable To add and define a new global variable:
- Select New Variable to open the Add Global Variables dialog box.
- Enter a name for the variable. Names should be descriptive and unique within the app.
- Enter a short description for the variable that describes its purpose.
- Enter a default value for the variable. The default value is the value that appears at the start of the first session of an app.
- Choose whether to retain the value of the variable across app sessions. When disabled, SOTI Snap disables the value of the variable each time you close the app.
- Optional: Add to add another variable. Variables are not saved as a set. Once you save the variables, SOTI Snap saves each as a separate entry.
- Select Save to save the global variable and close the dialog box.
Result: Global variables appear in the Global Variables tab of the Data Connection Rules view of the Canvas.
Editing a Global Variable To edit a global variable:
- Beside the variable that you want to update, select > Edit to open the Edit Global Variable dialog box.
- Make your changes and select Update.
Result: The referenced locations show the changes after publishing the app.
Deleting a Global Variable To delete a global variable:
- Beside the variable that you want to delete, select > Delete to open the Delete dialog box.
- Select Yes to confirm the deletion.
Result: The referenced locations show the deletion after publishing the app.