Iterate csv file and store column value in variable
Hello Talend Team, I have list of csv file which contain transaction details and I want to find distinct accountid from all of them for second subjob. for example my csv file contain data like Tractionfile 1 AccountId TranctionId BalanceAmt 1 112 100.00 2 201 100.00 4 113 200.00 1 114 400.00 Tractionfile 2 AccountId TranctionId BalanceAmt 2 202 200.00 3 564 800.00 1 205 555.00 I want to store only distinct AccountId separated by comma in context variable to use in another subjob. like context.variable = "1,2,4,3"; my job desing tfileList-------iterate---->tFileInputeDelimeter---------->tMap-----tLogRow------> (want to calcualte context.variable (want to use context.variable value here) value here )
Please suggest me how to find distinct account id and store it in context variable. Thank you, Nitin
Hi
Try this:
tFileList -> tFileInputDelimited -> tUnite -> tFilterColumns -> tDenormalize -> Output
The tUnite unites the iterations into a single flow (much like writing all of the inputs to a single interim file, then reading the interim file again).
Make sure the tDenormalize has "Merge same value" checked - this will get rid of duplicate account ids.
JB