Professional Documents
Culture Documents
talendtutorials
Get to learn Talend ETL Basics
1 of 6
4/4/2014 10:39 PM
The output for the above input should look like below : employee_id, salary, cumulative_sum 10, 1000, 1000 20, 2000, 3000 30, 3000, 6000 40, 5000, 11000 Here, the cumulative_sum column is addition of salary+previous rows cumulative_sum So obviously we will have to store the previous rows cumulative_sum in some variable. Below is the logic for that: We are going to need a tFileInputDelimited, a tjavarow , a tLogRow and a temp variable to get the output.
Once you have done the seings for tFileInputDelimited, create a temporary variable under the contexts tab as below : Dont forget to give the variable a default value of 0 in the Values as Table tab.
(hp://talendtutorials.les.wordpress.com/2012/01/temp_var1.png) Create a temp variable as above Now move on to tJavaRow.Double click on tJavaRow.Enter the below code in the Code section of the tJavaRow.Dont forget to sync columns. Now run the job. Your output would be : 10|1000|1000 20|2000|3000
4/4/2014 10:39 PM
2 of 6
3 of 6
4/4/2014 10:39 PM
mention in PATH your location of bin and jre/bin (;%JAVA_HOME%\bin;%JAVA_HOME% \jre6\bin) < copy paste this, the path should be an exact match.Sometimes ppl have jre instead of jre6 so take care in that case and change your path accordingly. Step 3 : Once this is done goto JAVA_HOME directory (i.e path that you have for JAVA_HOME) through cmd and type java -version if u get a proper o/p you can double click the Talend exe in your Talend extracted folder. If you have a 64 bit OS your exe is TOS_DI-win-x86_64.exe else for 32 bit OS it is TOS_DI-win32x86.exe double click on it !
4 of 6
4/4/2014 10:39 PM
Hi, Below is an example where we group similar items of a list. To keep it simplei have a le with 2 columns as below I m uploading this le as .doc le.Please change the extension to .csv once downloaded. Get the le from here : group_same_ids (hp://talendtutorials.les.wordpress.com/2012/01 /grp_similar_tothr.doc) Output should be : Col1 a b x Col2 l,m,n p,q y
To achieve the above. we need a Denormalize component. Create a Job for it is as below File contents :
Here we are nding out the top 4 salaries of an employee table in oracle HR schema. In SQL we would just simply write a query and fetch those values. Same has been demonstrated in the below link.
hp://talendtutorials.les.wordpress.com/2012/01/grp_smlr_entrs_dnorm_seings2.gif)
(h p://talendtutorials.les.wordpress.com/2012/01/grp_smlr_entrs_sort_se ings2.gif) For this to work on your pc you need to have oracle installed or create your own simple table to test. The seing for tSort component is as above :
talendtutorials Follow
Follow talendtutorials
Powered by WordPress.com
6 of 6
4/4/2014 10:39 PM