Friday 22 February 2013

Talend: Fetch records deleted by tjdbcoutput component (or other database output) in talend and storing it to global variable


Problem -
Fetching number of records deleted/inserted by tjdbcoutput component (or any other tDatabaseoutput comonent) and performing mathematical operation of addition and saving this value to global variable

Solution -
tJDBCOutput_1 - is our output component.
tJDBCOutput_2 - is our another output component.
DEL_ROW_COUNT - is our global variable to store deleted row by above two components

Talend provides NB_Line_Inserted/Deleted/Updated variables for different database output components which we can use after the component has finished.

What we will do is on subJobOk of these components we use java code in tJava component, where we use java functions to get value of these NB_Line* variables and do mathematical operation and store final value to global variable.





Java code is below
globalMap.put("DEL_ROW_COUNT",
Integer.toString((Integer)globalMap.get("tJDBCOutput_1_NB_LINE_DELETED") +
(Integer)globalMap.get("tJDBCOutput_2_NB_LINE_DELETED")));



1 comment:

  1. Its really good to implement the programs and modules with Talend Integration Studio.. It look like very easy to implement than any other software.

    ReplyDelete