Pages

Subscribe:

Thursday, February 24, 2011

Using Informatica Normalizer Transformation

Normalizer, a native transformation in Informatica, can ease many complex data transformation requirement. Learn how to effectively use normalizer here.

Using Noramalizer Transformation

A Normalizer is an Active transformation that returns multiple rows from a source row, it returns duplicate data for single-occurring source columns. The Normalizer transformation parses multiple-occurring columns from COBOL sources, relational tables, or other sources. Normalizer can be used to transpose the data in columns to rows.

Normalizer effectively does the opposite of Aggregator!

Example of Data Transpose using Normalizer

Think of a relational table that stores four quarters of sales by store and we need to create a row for each sales occurrence. We can configure a Normalizer transformation to return a separate row for each quarter like below..

The following source rows contain four quarters of sales by store:
Source Table
StoreQuarter1Quarter2Quarter3Quarter4
Store1100300500700
Store2250450650850

The Normalizer returns a row for each store and sales combination. It also returns an index(GCID) that identifies the quarter number:

Target Table
StoreSalesQuarter
Store 11001
Store 13002
Store 15003
Store 17004
Store 22501
Store 24502
Store 26503
Store 28504

How Informatica Normalizer Works

Suppose we have the following data in source:
NameMonthTransportationHouse RentFood
SamJan2001500500
JohnJan3001200300
TomJan3001350350
SamFeb3001550450
JohnFeb3501200290
TomFeb3501400350

and we need to transform the source data and populate this as below in the target table:

NameMonthExpense TypeExpense
SamJanTransport200
SamJanHouse rent1500
SamJanFood500
JohnJanTransport300
JohnJanHouse rent1200
JohnJanFood300
TomJanTransport300
TomJanHouse rent1350
TomJanFood350
.. like this.

Now below is the screen-shot of a complete mapping which shows how to achieve this result using Informatica PowerCenter Designer


Setting Up Normalizer Transformation Property

First we need to set the number of occurences property of the Expense head as 3 in the Normalizer tab of the Normalizer transformation, since we have Food,Houserent and Transportation.
Which in turn will create the corresponding 3 input ports in the ports tab along with the fields Individual and Month

Normalizer Property Tab

In the Ports tab of the Normalizer the ports will be created automatically as configured in the Normalizer tab. Interestingly we will observe two new columns namely GK_EXPENSEHEAD andGCID_EXPENSEHEAD.
GK field generates sequence number starting from the value as defined in Sequence field while GCID holds the value of the occurence field i.e. the column no of the input Expense head.
Here 1 is for FOOD, 2 is for HOUSERENT and 3 is for TRANSPORTATION.

Normalizer PORTS Tab GCID_

Now the GCID will give which expense corresponds to which field while converting columns to rows.
Below is the screen-shot of the expression to handle this GCID efficiently:


image:Expression to Handle GCID


0 comments:

Post a Comment