Example Java Transformation in Powercenter

This is an example how to use the Java Transformation in Powercenter. The transformation takes one comma delimited row and outputs multiple rows for each item in the list. You'll need to take these steps:

Create a new Java Transformation

In this case we want to generate multiple output rows for a single input row so we choose active

Define input and output ports

Go to the ports tab and define the input and output ports. Make sure that you create an output group or your transformation won't work!

Assign header code

Assign the java code that needs to run before any data is coming in. This is the place to define variables. In this example i define the variables strDescr and splittArray.

String strDescr = null;
String[] splittArray = null;

Assign row code

On the Input Row tab you'll need to set the code that needs to run for each input row. You'll have to assign a value to each output port and run generateRow for each output row.

This code splits the inputrow at the delimiter and puts each value in an array. It then loops through each value and creates a row for each value.

strDescr = DESCRIPTIONS_IN;
splittArray = strDescr.split(",");
for(int i = 0; i < splittArray.length; i++){
   DESCRIPTION_OUT = splittArray[i];
   generateRow();
}