System.Activities.Statements.FlowSwitch<Type>
- FlowSwitch is a flowchart specific activity that splits the control flow into three or more branches, out of which a single one is executed based on a specified condition.
Cases
- All the possible sequences, out of which a single one is executed, based on its match with the provided Expression.
- The connected activities are automatically numbered, and the first one is the default case.
- The case number or assign a different default case can be changed by clicking the corresponding arrow and changing the value of the case field, or, respectively, selecting the IsDefaultCase check box.
- If none of the cases match the Expression, the default case is executed.
- If no default case is added, the process is executed, but the activity does not return any output.
Properties
Misc
- DisplayName (String) – To set a meaningful name according to the user.
- Expression (Activity<Type>) – Define a condition/an expression which return a value of selected datatype.
Example
To use FlowSwitch activity, create an automation that checks the current date month falls on which season (Summer/Winter/Spring/Autumn), and displays the season name in the Output panel according to the current date month.
- Create a flowchart.
- Add a FlowSwitch activity with selecting the TypeArgument and connect it to the Start
- In the Properties panel, type CInt(((DateTime.Now.Month Mod 12) + 1) / 4)
- Add a WriteLine activity in the default case and type “Default Case” in the Text
- Add a WriteLine activity in case 0 and type “Autumn” in the Text
- Add a WriteLine activity in case 1 and type “Winter” in the Text
- Add a WriteLine activity in case 2 and type “Summer” in the Text
- Add a WriteLine activity in case 3 and type “Spring” in the Text
- Run the process and see the season name displays in the Output panel after the execution.