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

  1. In the Canvas, open Data Connection Rules. Move to the Global Variables tab.
    Global Variables tab in Data Connection Rules
    Global Variables tab in Data Connection Rules 2
  2. 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:

    1. Select New Variable to open the Add Global Variables dialog box.
    2. Enter a name for the variable. Names should be descriptive and unique within the app.
    3. Enter a short description for the variable that describes its purpose.
    4. 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.
    5. 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.
    6. 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.
    7. 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:

    1. Beside the variable that you want to update, select > Edit to open the Edit Global Variable dialog box.
    2. 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:

    1. Beside the variable that you want to delete, select > Delete to open the Delete dialog box.
    2. Select Yes to confirm the deletion.

    Result: The referenced locations show the deletion after publishing the app.