Data Flow Elements
The Data flow components are responsible for constructing, executing and controlling scenario logic and data flow.
Branch
Branch is the basic logic component. For the Branch object, write a Boolean expression, that is, an expression that evaluates as true or false.
The flow of the script branches according to the yes/no nodes of the Branch object, which refer to a true and false evaluation respectively.
You can flip the yes/no sides to make your scenario more readable. Right select the branch object and select Flip Step Sides, as shown below:
Switch
The Switch element defines a multi-way split in the flow of the scenario according to the evaluated expression. Instead of using a simple "branch element" that is set to two exit points, the Switch statement allows multiple exit points, simplifying the scenario flow.
The switch expression and cases are compared as strings. The expression is converted to a string automatically, but the case values must be provided as plain text (without quotes).
In the example above, the scenario.colo
variable, a string, is compared with the cases below red
, green
, blue
. After defining the expression and the cases, you can connect each of the cases to the next
steps in the flow.
There is a default case in each switch that is executed if none of the other case values are matched.
Begin scenario
Sharing the same functionality between different scenarios is highly common. It is possible to create a scenario that can be called throughout the project. It can receive input parameters and return output to the calling scenario, making it reusable. The variables defined in such a scenario are local to the instance of the subscenario, so they won't affect other variables, even variables with the same name. To call a subscenario, drag the Begin Scenario step onto the canvas.
Select the relevant Scenario trigger value from the dropdown menu. Define the Arguments with either a literal or a variable object. Define the output Variable name with the return value from the called scenario, as shown in the example below:
The called scenario can access the argument passed from the calling
scenario by using the scenario
variable. For example: scenario.varName
Replace scenario
You can use the Replace Scenario option, in cases you wish to completely replace a scenario and end the current scenario.
End scenario
When you're ready to return from the called scenario, place an "End object" from the End Scenario element in the subscenario. You can access the output in the variable you defined in the parent scenario for the subscenario results.