Tuesday, December 25, 2012

Java Transformation in Informatica

Java Transformation in Informatica

Informatica PowerCenter extended its functionality to support the Java language from the version of 8.0. Informatica PowerCenter provides a simple programming interface to implement transformation functionality with java programming language. Informatica PowerCenter facilitates the developers/users to import the java packages and use them to achieve specific business rule which defined in the java package. Looping of data is now easily possible with help of Java transformation. The main advantage of this transformation is multiple rows can be generated for a single input row based on the condition. The Normalizer can generate Static rows based on the ‘Occurs’ clause where we will specify a static number. If we want to generate multiple rows based on a dynamic value, then we would depend on java transformation. Informatica power center client uses JDK to compile java code and generates byte code. PowerCenter client stores the byte code in the PowerCenter repository. The Integration service uses JRE to execute the generated byte code at run time.

Java transformation can be an Active or Passive transformation.
Java transformation has common input/output ports 
like other transformations.
Let’s have a simple example to implement java transformation.
Source: PATIENT_PRE_DTL

Target: PATIENT_PRE_TBLS
The source table contains the patient ID, Name and tablets (Separated by #) which doctor have prescribed for a patient. 
The data from source should be populated into the target as mentioned in the above example. A single row from source table has to be converted into multiple rows based on number of tablets, and load into the target table.
This is a typical scenario where we cannot use Normalizer Transformation since we have no information about the occurrence (Number of tablets prescribed by doctor may be varying for patient to patient). We can achieve this functionality in a simple way by using Java transformation.
1. Create source definition.
2. Create Target Definition.
3. Create a mapping.
a. Create source and target instances
b. Place Java Transformation à Choose Active;
c. Drag and drop all the ports from Source Qualifier to Java Transformation. An Input/output will automatically be created in Java transformation under output tag.
d. Under “On InputRow” tab place the following code

String str=Tablets;
String[] temp;
String delimiter = ‘#’;
temp = str.split(delimiter);
for (int i =0; i< temp.length; i++){
Tablets = temp[i];
generateRow();
}

generateRow() – This is a build-in function which is used to generate output row. As per our code Java transformation takes a single record as an input and creates multiple records based on the number of tablets.

3 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. "You tried to convey something new with the blog regarding the java transformation in informatica and it will be useful for all. I had an doubt of How to use union transformation in informatica ? Please clear it with your updation regarding my doubt.
    Informatica Training in Chennai
    "

    ReplyDelete

Thank you :
- kareem