Router Transformation in Informatica

The Router Transformation in Informatica is just like IF condition or CASE statement. It will check the given condition and based on the condition result, an output will be sent to the appropriate destination path. This is similar to Filter transformation and we can use the Router Transformation when we have to test multiple conditions.

The Router Transformation in Informatica is very useful in real-time. For example, if we have the situation where we want to store the Employees records whose salary is greater than 40000 in one Table and less than 40000 to another table then we can use this Router Transformation in Informatica to split the data based on the specified expression.

For this Informatica Router Transformation example, we are going to use the below show data. Here, Our task is to conditionally split the below-shown data and store them in multiple database tables.

Router Transformation in Informatica 1

Configure Router Transformation in Informatica

Before we start configuring the router transformation in Informatica, First connect to Informatica repository service. In order to connect with Repository service we have to provide the Informatica Admin Console credentials so, Please provide the appropriate Username and Password and click on Connect button as shown below.

TIP: Here you have to provide the Admin Username and password that you specified while installing the Informatica Server.

Router Transformation in Informatica

Creating Router Transformation in Informatica Source Definition

Once you connected successfully, Please navigate to Source Analyzer and define your Sources. In this example, we are using [Products] table from SQL Server database as our source definitions. Please refer Database Source in Informatica to understand the steps involved in creating source definition

Router Transformation in Informatica 2

Create an Informatica Router Transformation Target Definition

Please navigate to Target Designer and define the Target. In this example, we are using the already created SQL tables (Router1, Router2 and Router3) as our target definitions. Please refer Create Informatica Target table using Source Definition to understand the steps involved in creating a target definition

Router Transformation in Informatica 3

Creating Router Transformation in Informatica Mapping

In order to create a new mapping, Please navigate to Mappings menu in Menu Bar and select the Create.. option. This will open the Mapping Name window as shown below. Here, you have to write a unique name for this mapping (m_Router_Transformation) and click OK button.Router Transformation in Informatica 4

Next, Drag and drop the [Products] source definition from Sources folder to the mapping designer. Once you drag the source, the PowerCenter designer will automatically create the default transformation called source qualifier.

Creating Router Transformation in Informatica

In order to create Router transformation in Informatica, Please navigate to Transformation menu in Menu Bar and select the Create.. option as we shown below.

Router Transformation in Informatica 5

Once you click on the Create.. option, Create Transformation window will be opened as shown below. Please select the Router Transformation from the drop-down list and specify the unique name (rtr_Sales) for this transformation and click on Create button

Router Transformation in Informatica 6

Once you click on the Create button, router transformation will be added to the mapping designer. In order to route the data, router Transformation requires some data so, please connect the Source definition with the transformation by dragging the required fields.

Router Transformation in Informatica 7

From the above screenshot, you can observe that we have our INPUT data. Let us define the output groups so, Double click on the Informatica Router transformation to provide the route conditions. From the below screenshot you can see the list of available properties in the Transformation tab:

  • Select Transformation: By default, it will select the transformation you clicked on.
  • Rename: This button will help you to rename the router transformation to a more meaningful name.
  • Make Reusable: If you check mark this option then, this transformation will become reusable transformation.
  • Description: Please provide a valid description of this transformation.
Router Transformation in Informatica 8

Below screenshot will show you the list of available options in the Informatica Router Transformation Ports tab:

  • Port Name: List of available column names. By clicking the New column button you can add new columns and by clicking the scissors button you can delete the unwanted columns.
  • I: Columns that are check-marked under this section are the router transformation Input columns.
  • O: Columns that are check-marked under this section are the router transformation Output columns. If you unchecked any column then, that column will not be available to load in the target table.
Router Transformation in Informatica 9

Within the Groups tab, we have to define the group names and condition we want to use. From the below screenshot, you can observe that we created two groups (LEAST SALES and MEDIUM SALES).

TIP: The router transformation in Informatica will automatically create the default group (i.e., DEFAULT 1). Records which does not belong to above-mentioned groups will be stored in this group.

Router Transformation in Informatica 10

Let us provide the expression or condition for the First group (Least Sales) by clicking the arrow button as we shown below. This will open the Expression Editor to write a custom expression.

Here, we want the records whose Sales Amount is less than 400 so, we are writing the below-shown expression (SalesAmount < 400).

Router Transformation in Informatica 11

Next, provide the expression or condition for the Second group (Medium Sales) by clicking the arrow button and write the condition (SalesAmount >= 400 AND SalesAmount < 2000) we have shown below.

Router Transformation in Informatica 12

All the remaining rows will be acted as default output and they will be stored in DEFAULT 1 group (Sales Amount > 2000)

Router Transformation in Informatica 13

Once you finish configuring the properties, Click OK to close the transformation window.

Next, Drag and drop the target definitions (Router 1, Router2 and Router3) from Targets folder to the mapping designer as shown below.

Router Transformation in Informatica 14

Next, Please connect the Transformation LeastSales (Output Group 1) with the first target definition (Router 1), MediumSales (Output Group 2) with Router 2 and Default 1(Default Group) with Router 3

Router Transformation in Informatica 15

Before we close the Mapping, Let us validate the mapping by going to Mapping Menu bar and selecting the Validate option.

Creating an Informatica Router Transformation Workflow

Once we finish creating the Mapping we have to create the workflow for it. PowerCenter Workflow manager provides two approaches to create a workflow.

In this Informatica Router Transformation example, we will create the Workflow manually. In order to create new Informatica Workflow, Please navigate to Workflows Menu and select the Create option.

This will open Create Workflow window as shown below. Please provide the unique name (wf_Router_Transformation) and leave the default settings.

Router Transformation in Informatica 16

Once we created the workflow, our next step is to create a session task for our mapping.

NOTE: We strictly recommend to refer Informatica Workflow article to understand the steps involved in creating Workflow manually.

Creating Session for Router Transformation in Informatica

There are two types of sessions in Informatica:

For this Informatica Router Transformation example, we are going to create Non-reusable Session. Please navigate to Tasks Menu and select the Create option to open the Create Task window. Here you have to select the Session as Task type (default) and enter a unique name (S_Router_Transformation) for the session.

Once you click on the Create button, a new window called Mappings will be opened. Here you have to select the mapping you want to associate with this session. From the below screenshot you can observe that we are selecting the mapping (m_Router_Transformation) that we created earlier (in Step 3).

Router Transformation in Informatica 17

Double click on the Session Task to configure it. Although we have to configure Sources, targets and some common properties, we not explaining any of them. We strictly recommend visiting Session in Informatica article to understand the properties.

From the below screenshot you can observe that the Router Transformation in Informatica workflow is a valid one. Now, Let us start the Workflow by navigating to Workflows menu and selecting the Start Workflow option.

Router Transformation in Informatica 18

Once you select the Start Workflow option, Informatica PowerCenter Workflow monitor will be opened to monitor the workflow. From the below screenshot you can observe that our workflow is executed without any errors.

Router Transformation in Informatica 19

Let us open the SQL Server Management Studio to show you the result of [Router 1] (i.e., an output of the Least Sales group)

Router Transformation in Informatica 22

Let’s see the result in [Router 2] Table in SQL Server. The following screenshot will show you the output of the Medium Sales group

Router Transformation in Informatica 21

Let’s see the result in [Router 3] Table in SQL Server. The following screenshot will show you the output of the Default group

Router Transformation in Informatica 20

Please refer to Informatica Filter transformation article.

Comments are closed.