What the Use Case for a Switch vs Flow Switch

Hey @Hibb

Switch Activity:

The Switch activity evaluates a specified expression and executes the activity from a collection of activities whose associated key matches the value obtained from the evaluation.

A Switch activity contains an Expression and a dictionary of Cases. Each case in the dictionary consists of a pair that contains a key and an activity that serves as its corresponding value. The Switch activity evaluates the Expression and compares it against each of the keys. If a match is found, the corresponding activity is executed. Only one match is possible because dictionary keys must be unique according to the type of equality defined by the equality compare of the dictionary. If no match is found, the Default activity is executed.

Example: SwitchCase.xaml (5.8 KB)

FlowSwitch:
A FlowSwitch activity works like a FlowDecision except instead of being restricted to a True and False branch. Each branch of a FlowSwitch activity is called a FlowStep.

The FlowSwitch activity is a conditional node that provides branching for the flow of control based on match criterion when more than two alternative branches are required. If the flow branching requires only two paths, use the FlowDecision activity instead.

The FlowSwitch<System.int32>("In uipath) activity contains an Expression that returns a value of type Int32 when evaluated. The activity also contains a set of Cases, which specifies a unique mapping from possible results of this evaluation to a set of FlowNode objects. The FlowNode executed is the one whose object of type int32 matches the value of the evaluated Expression. A Default case can (optionally) be provided for the case in which no match is obtained.

Example: FlowSwitchName.xaml (11.7 KB)

Regards…!!
Aksh

22 Likes