Wednesday, March 16, 2011

Java Transformation Example

Converting One Row into Multiple Rows...Using Java Transformation..
Cosider my Source is a Flatfile and the data is like
ORDER_NO,ORDER_NAME,CHAIN
101,SOAP,4
102,CREAM,3
103,SHAMPOO,2
104,OIL,1

Now i want my target as..
 Target
ORDER_NO,ORDER_NAME,CHAIN
101 SOAP 4
101 SOAP 4
101 SOAP 4
101 SOAP 4
102 CREAM 3
102 CREAM 3
103 SHAMPOO 2
103 SHAMPOO 2
104 OIL 1



I am going to achieve this using Java-Transformation
> Create Java Tranformation and create InputGrooup and OutputGroup with ports as shown in diagram.
> Connect the ports from SQ to Exp-Tr(not needed) and then to InputGroup of Java-Tr.

> Open Java-Tr properties and chose Java Code tab.. and write the code as below..


> Compile the Java code for any errors..once code gets Successfully compiled..create session and workflow..and run the session..observ the output ..


-- Ram


4 comments: