Simulation Triggers & Variables
This article provides an overview of what Simulation triggers and variables are, and how you can use them within the Evolve tool.
When creating simulations the need to dynamically control elements may be required. This is where variables and triggers come become useful.
The Simulation component variables are similar to Logic variables, though they can only be used in the component itself.
Simulation Elements can use a variable to store a string (text), number, or a boolean (true or false) value. The type of element determines which type of variable can be used. For example, a Text Input element can store the user input to a string type variable. Some elements can also display the value of a variable.
Screen Triggers can “listen” to changes to a variable’s value in order to show, hide, enable, disable or reset an element.
Variables can be managed and created in two places:
- Simulation variables
- Screen variables
Simulation variables are created in the Behaviour section of the component editor. These variables can be used by every screen. An example use case would be a Text Input element that can store the user’s email to a Simulation Variable then on a subsequent screen, displaying the email in a Display Text element.
Screen variables are created in the Screen Settings editor. These are variables that can only be accessed by the screen that they were created in. These are best used for changing the user interface based on user input. An example would be a button that is disabled until the variable has a value.
Once a variable has been created you can use it as part of a Simulation Trigger. Triggers are created in the Screen Settings menu.
The main purpose of a trigger is to dynamically change the state (hidden, visible, enabled, disabled) of elements on the screen based on the value of selected variables.
A trigger is consists of two parts:
A trigger needs at least one condition to work. All conditions must be true for the trigger to run its action. When any simulation or screen variable changes its value, the trigger will go through each of the conditions to check if that variable has been set to a condition. If it has, then the trigger will evaluate all of its conditions to check if it can run its action.
All triggers will also check their conditions when the screen has loaded or after an incorrect attempt. This means that triggers can be used to set the default state of elements if needed.
A trigger condition is made up of the following parts:
- Condition Variable - This is the variable that this condition will “listen” and run the Condition Comparison against.
- Condition Comparison - Sets how to compare the condition variable to the Condition Value. The options available will change depending on the variable’s value type.
- Condition Value - Set’s the value to compare against. The field displayed will change depending on the variable’s value type or the comparison type.
- Is Strict - This setting will be available if comparing a string type variable to a text value. If enabled then the variable must match exactly (including spaces) with the condition value.
When all the trigger’s conditions have been evaluated as true, the trigger’s action will be run. The actions that are available are:
- Submit Screen
- Reset Elements
- Enable or Disable Elements
- Show or Hide Elements
- Show next instruction
Save responses to variables
All interactive elements are able to save a value to a variable. This is outlined in the table below:
Element: Read from variable
Did this article help?
Let us know by leaving a star rating or review at the top of this article.