Wednesday, 8 January 2014

Run if example in Talend ETL [How to write conditions]

Run If conditions is used to develop the logics in your ETL job.
For example below jod design describes you how to work with it.

Drag and drop the below shown components (tJava_1, tFileExist_1, tFileExist_2)
Let's say you are passing a file name using tJava component 
Refer this post for tJava explantion : here
Lets say file 1 name is "ABC.XLSX" 
and file 2 name is "PQR.XLSX" 

Execute upper portion if the file name is "ABC.XLSX" or execute below part of the job if the file name is "PQR.XLSX"

Right click on tJava component ->Click on Trigger -> select Run If

Condition 1 :
context.filename.substring(0, context.filename.lastIndexOf("_")).trim().equals("ABC")

Condition 2:
context.filename.substring(0, context.filename.lastIndexOf("_")).trim().equals("PQR")

To edit the condition, click on "If(order1)" and press F2.

In this way you can work with the tJava component along with some conditions provided on it.