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. Drag the flow control component onto the canvas.

For the Branch object, write a Boolean expression, i.e., an expression that evaluates as true or false.

The flow of the script will branch 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. Just right click 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 ${level} variable, a number, is converted into a string and compared with the string cases below it: 1, 2 or 3. After defining the expression and the cases, you can connect each of the cases to the next steps in the flow.

Note that there is a default case in each switch that is executed if none of the other case values are matched.

Sub 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 sub-scenario, so they will not affect other variables, even variables with the same name. To call a sub-scenario, 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 ${scenarioArgs} variable. For example: ${scenarioArgs}.["varName"]

When you are ready to return from the called scenario, place an "End object" from the End Scenario With Result element in the sub-scenario. You can access the output in the variable you defined in the parent scenario for the sub-scenario results.

  • End Scope
    • scenario: Ends current scenario and returns the value
    • conversation: Ends current conversation and returns the value

Additionally, you can use the Replace Scenario option, in cases you wish to completely replace a scenario and end the current scenario.