Using Java Transformation
A Java transformation provides a native programming interface to define transformation functionality with the Java programming language. You can use a Java transformation to define simple or moderately complex transformation functionality without advanced knowledge of the Java programming language or without using an external Java development environment.
Types of Java transformation:
· Active: Generates more than one output row for each input row in the transformation.
· Passive: Generates one output row for each input row in the transformation.
Example :
Source Table:
Col1 | Col2 | Col3 |
11 | 12 | 13 |
21 | 22 | 23 |
31 | 32 | 33 |
Our requirement is to transpose the values using Java Transformation as shown below:
Target Table:
Col1 | Col2 | Col3 |
11 | 21 | 31 |
12 | 22 | 32 |
13 | 23 | 33 |
Design a mapping as shown below
Create Source and Target definition and connect all the input and output ports as shown above.
Please note that you must select the type as “Active” for Java Transformation.
The ports tab will look like as shown below:
Go to Java Code tab and select Helper Code tab. We will define all the required variables here.
Under On Input Row tab, whenever the input row comes, we will store all the values in the buffer sequentially.
Under On End of Data tab, we will define our logic and generate the output values.
No comments:
Post a Comment