Switch Transformation in Centerprise 7.5

Overview

Switch transformation is among the newly introduced transformations that are included in Centerprise 7.5 version. It is a basic, yet an extremely useful transformation and has applications in a wide range of business use cases.

This transformation can be applied when there is a need to replace information stored in the source data with some other relevant information. Information is switched (or replaced) based on some preassigned rules.

Switch Transformation Explained with a Business Use Case

An organization maintains a database for their employees. Employee_Info table in that database contains information such as employee’s name, department, salary and employee ID.

Figure 1: Source file and data preview before the switch transformation is applied

For the ease of maintenance, the organization assigned a specific number to each department (Marketing, Sales, Finance etc.) and that information is recorded in the Department field as shown in figure 1.

Using the Switch transformation, the numeric values stored in the Department field can be easily replaced with their corresponding department names.

Basic Mode in Switch Transformation

The basic mode in Switch transformation works like a List Lookup. In this example, we want to replace the numeric information stored in the Department field with their actual corresponding departments.

Figure 2: Switch Transformation (Top: Basic Mode – Bottom: Enhanced Mode)

Drag-and-drop the transformation from the toolbox to the designer and map the required fields. Here we are mapping EmployeeID, Department, and Salary fields from the source file to the Switch transformation (BasicMode_Switch).

In the properties window of the transformation, select the field that you want to perform the switch operation on, and specify the criteria in Case Value, based on which Centerprise will look for the information and replace it with the given information in the corresponding Output Value.

Figure 3: Switch transformation properties window (Basic mode)

Now if you preview the output or write the transformed data to any destination, you will see that the numbers in the Department field are replaced with the information that is based on the rules assigned in the properties window shown in figure 3. In a case where Centerprise won’t find any matching case value, it will automatically assign the specified default output value, which is Admin in this example.

Figure 4: Data preview after the Switch transformation is applied

Enhanced Mode in Switch Transformation

The Enhanced mode in the Switch transformation provides more flexibility to the feature because it enables users to set lookup criteria by writing expressions. Figure 5 shows the properties window of the enhanced mode in Switch transformation.

Figure 5: Switch transformation properties window (Enhanced Mode)

Suppose our fictitious organization has set criteria for issuing credit cards. Employees whose salary is less than $3,500 are not eligible for the credit card. Employees with a salary between $3,500 and $5,000 are eligible for the Silver card. Other similar assignments can be seen in the Case Expression column in figure 5.

The organization has the data about employee’s salaries and the ranges for the issuance of credit cards. In this case, employee’s salary, which is the information that is stored in the database, is not relevant to the concerned department. What they’re looking for is to identify which employee is eligible for which perk. This can easily be achieved by matching the salary ranges defined in the Case Expression and switching it with the corresponding information about the credit cards specified in the Output Expression.

Figure 6 shows the output preview for the enhanced mode case in the Switch transformation.

Figure 6: Output preview of switch transformation in the enhanced mode

Benefits of the Switch Transformation

Switch transformation gives users more control over data as it enables them to transform the given information into something more relevant, which is best suited to the given business scenario. When applied to any data set, switch transformation matches source data for the criteria specified by the user, and replaces the information with the desired output (also specified in the layout) wherever the criteria is met.