FlowSwitch

When to use this activity

This activity helps you handle multiple scenarios based on a single input. The control flow is split into several branches, one of which is executed by checking the value of the specified variable against the mentioned cases.

Figure 1

Activity Name

Picture

FlowSwitch

a e

Technical Reference

Figure 1.1

p

S.no

Description

1

Displays the action that the activity performs

2

Define the input/variable that is required to be validated.

 

Figure 1. 2

p

S.no

Description

1

Define the case that is to be actioned

2

Enables you to check the default value.

 t  Switch type is selected based on your requirement.
              
Here, the selected datatype is Integer.

Scenario

In the above scenario, the result was printed by validating if the value is lesser or greater than a defined value. Here, the requirement is to compare the defined value with multiple cases.

Illustration

a Activity: To handle multiple scenarios based on an input, using the "Flow Switch" activity.

Step1 - Drag a Flow Switch activity and connect it under the true or false branch based on the output of the Flow decision activity.

  • Enter the variable name item in the expression field, which was the input to the Flow decision activity
  • Connect a Writeline activity under the Flow Switch. In the property field, update the case as "20". If the value of item is 20, this branch gets executed and prints the message, "The value of item variable is 20
  • Connect a Writeline activity under the "Flow Switch" activity. This time, in the property field, update the case as "5". If the value of item is 5, this branch gets executed and prints the message, The value of item variable is 5"
  • Connect a Writeline activity under the Flow Switch. In the property field, update the case as 25. If the value of item is 25, then, this branch gets executed and prints the message, The value of item variable is 25. 

Example

The aforementioned scenario uses each FlowChart activity to perform the operation.

Figure 1.3

e