top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Convert columns into rows in Informatica using Java Transformation

0 votes
2,345 views

Having a scenario that source data like below in table
enter image description here

Target Output required as
enter image description here

You can use the Java code in this example to create and compile an active Java transformation
enter image description here

Create a java transformation with one input and one output field as shown in below snapshot.
enter image description here

Connect concatenated fields (A#B#C) from expression transformation to FLD_INPUT of java transformation
Now go to java code tab and paste below code
String[] str_fld_nm=FLD_INPUT.split("#");
for(inti=0; i < str_fld_nm.lenght; i++){
FLD_OUTPUT =str_fld_nm[i];
generateRow();
}

It is using java functionality of array to break input field and multiple fields and then use generateRow () to produce multiple rows.
enter image description here

Now connect FLD_OUTPUT to target, so output will be as shown below.
enter image description here

Core functionality is using Java functionality, to break concatenated string into multiple fields and use generateRow() to produce multiple rows.

By using Router & Normalizer transformations also we can convert rows into columns.
enter image description here

posted Jun 17, 2014 by Shatark Bajpai

  Promote This Article
Facebook Share Button Twitter Share Button LinkedIn Share Button

...