Switch is a control statement that executes a set of activities based on the result of a comparison between a controlling expression and the labels specified in the switch block. This type of activity helps in allowing the value of a variable or expression to select the block for execution from a list of candidates that represent the different possibilities that can occur.
Use of a Switch results in improved performance and readability when compared to that of the If Else ladder. A Switch activity can contain another Switch activity, thus forming a nested Switch, which can yield better performance over other approaches.
Come, let's create this process in Process Designer:
Launch and create a new process in Process Designer
- Launch Process Designer from the Windows Start menu located under IntelliBuddies Enterprise
Create New Process
Click on New Process and fill in the new process details
- Int32 variables to hold input number.
In Activity panel search for Input Dialog
- Add Switch by setting type as Int32.
- Click on condition and set user input. Add 4 cases with key value set to 1,2,3,4 respectively.
- Add Message Box under each case and also default and set appropriate message.
Save the process
- From the Design tab ribbon, click on Save
Run the process
- From the Design tab ribbon, click on Run
Make sure the process executes and displays the number entered.
Download Example (C#)