Filter Transformation in Informatica

The Filter Transformation in Informatica filters the records based on the specified expression/condition. The Filter condition return Boolean TRUE or FALSE, which means the integration service will check each row against the specified condition. And if the condition is TRUE, then the Informatica Filter transformation will pass the row. Otherwise, it will skip the current row and check the next one.

Filter Transformation in Informatica is very helpful in real-time. For example, If you want to load the customer data whose sales value is above the minimum threshold etc. In this article, we will perform Filter Transformation on two SQL tables.

For this Informatica Filter Transformation example, we are using the [Dim Products] and [fact Internet Sales] tables from our [Adventure Works DW 2014] database.

Filter Transformation in Informatica Example

Before we start doing anything, First connect to the Informatica repository service with your Admin Console credentials.

Create an Informatica Filter Transformation Source Definition

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

Source Tables 1

Creating a Target Definition for Filter

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

Target Designer 2

Create a Mapping for Filter

In order to create a new mapping for Informatica Filter Transformation, Please navigate to the 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_Filter_Transformation) and click the OK button.

TIP: Please refer Mapping article to understand the steps involved in creating Mapping.

Create a Mapping 3

Next, Drag and drop the [Dim Products] and [fact Internet Sales] source definitions from the Sources folder to the mapping designer. Once you drag the source, PowerCenter Designer will automatically create the default transformation called source qualifier, as shown below.

Filter Transformation in Informatica 4

As we all know that the [Dim Products] and [fact Internet Sales] tables have the Primary and Foreign key relationship. So we removed one source qualifier and added the required fields from both tables to a single source qualifier.

Filter Transformation in Informatica 5

Creating a Filter Transformation in Informatica

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

Filter Transformation in Informatica 6

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

Filter Transformation in Informatica 7

Once you click on the Create button, filter transformation will be added to the mapping designer. In order to filter the records by an expression, filter Transformation requires some data. So, we have to connect the Source definition with the transformation using Autolink.. option (or select and Drag required fields).

Filter Transformation in Informatica 8

Double click on the Filter transformation to provide the filter condition. 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 filter transformation to a more meaningful name.
  • Make Reusable: If you check mark this option, then this transformation will become a reusable transformation.
  • Description: Please provide a valid description of this transformation.
Rename and Marke reusable options 9

The below screenshot will show you the list of available options in the Informatica Filter Transformation Ports tab:

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

The following screenshot will show you the list of available options in the Properties tab. By default, Filter Condition will be set to TRUE, and here only, we have to provide the condition. In order to specify the condition, click on the Arrow button as shown below.

TIP: If you specify the Filter Condition to FALSE, then the filter condition will not allow a single record.

Filter Transformation in Informatica 11

Once you click on the arrow button, the Expression Editor window will be opened, as shown below. Here you can write custom expressions using the available functions, Ports (Column Names), and Variables.

Filter Transformation in Informatica 12

For this example, we are using the simple expression i.e., SalesAmount > 2000. It means Informatica Filter transformation will return the records whose sales amount is greater than 2000

Filter Transformation in Informatica 13

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

Next, Drag and drop the target definition from the Targets folder to the mapping designer and connect the Transformation with the target definition. Please use the Autolink.. option to connect them.

Filter Transformation in Informatica 14

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

Create an Informatica Filter Transformation Workflow

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

In this Filter Transformation example, we will create the Workflow manually. In order to create a new 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_Filter_Transformation) and leave the default settings.

Filter Transformation in Informatica 15

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

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

Creating a Session

There are two types of sessions:

For this Informatica Filter 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_Filter_Transformation) for the session.

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

Choose mapping Name 16

Double click on the Session Task to configure it. Although we have to configure Sources, targets, and some common properties, we are explaining only a few properties. We strictly recommend visiting the Session article to understand the remaining properties.

From the below screenshot, you can observe that we assigned the $target variable to Connection Value, changed the Target Load Type option from Bulk to Normal mode, and check-marked the Truncate target table option to truncate the existing data from the destination table.

Mapping Targets 17

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

Filter Transformation in Informatica 18

Once you select the Start Workflow option, the 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.

Filter Transformation Workflow 19

Let us open the SQL Server Management Studio to check whether we successfully restricted the records with Sales Amounts less than 2000 using the Informatica Filter Transformation or not.

Destination Table 20