Router transformation is an active and connected transformation, and it is similar to the filter transformation, which is used to filter the source data.
In a Router transformation, Data Integration is used as a filter condition to evaluate each row of incoming data. It checks the conditions of each user-defined group before processing the default group.
If a row connects more than one group filter condition, Data Integration passes the row multiple times. We can drop rows that do not meet any of the conditions to a default output group.
If we need to check the same input data based on multiple conditions, then we use a Router transformation in a mapping instead of creating multiple Filter transformations.
The following table compares the Router transformation to the Filter transformation:
For example, when filtering the data form rollno =20, we can also get those records where rollno is not equal to 20. So, router transformation gives multiple output groups, and each output group can have its filter condition.
Also, there is a default group, and this default group has record sets that don't satisfy any of the group conditions.
For example, if we have created two groups for the filter conditions rollno=20 & rollno=30 respectively, then those records which are not having rollno 20 and 30 will be passed into this default group.
The data which is rejected by the filter groups will be collected by this default group, and sometimes there can be a requirement to store these rejected data. In this way, the default output group can be useful.
To allow multiple filter conditions, the router transformation provides a group option.
Creating Router Transformation
Follows the following steps to create the router transformation, such as:
Step 1: Create a mapping having source "STUD" and target "STUD_TARGET."
Step 2: Then in the mapping
Step 3: In the create transformation window
Step 4: The router transformation will be created in the mapping, select done option in the window.
Step 5: Drag and drop all the columns from Source qualifier to router transformation.
Step 6: Double click on the router transformation, then in the transformation property of it
Step 7: In the expression editor, enter the filter condition rollno=30 and select the OK button.
Step 8: Click on the OK button in the group window.
Step 9: Connect the ports from the group rollno_30 of router transformation to target table ports.
Now, when we execute this mapping, the filtered records will get loaded into the target table.