Switch Statement
The 'Switch' Activity is used to identify unique branches of the selected data source. This allows for a single data source to have unique chains of Activities for every different type of values. For example, a single data source could contain logic to handle different types of events.
After opening the 'Switch' activity, you will get the following configuration panel.
Default Configuration Parameters
Field | Description |
---|---|
Data Source | Value to execute the matched case. |
Cases | Multiple and different types of cases to perform unique operations in each case. |
Executing a Switch Activity
A Simple Example to configure the 'Switch' activity in PopFlow Studio.
Switch activity can be used if some data has unique requirements. You can add multiple cases to perform a unique operation on different data.
To add the cases click on the case button. It will add a panel as shown below.
Sample Switch Activity
The best way to see the power of this activity is to step through an extended example. Let us suppose that we have three types of customers: Bronze, Gold, and Platinum. We might also have customers that have not yet been entered into a particular program. For every customer, we need to execute different activities.
We are getting the customer details from the 'HTTPS' activity. you can refer to the 'HTTPS' activity to configure it.
Now, let’s create Case Switch that branches the workflow based on the CustomerType. After creating it will look like as shown below:
After adding the case you will notice that on the workflow designer page there are some buttons added as shown below.