• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Iterate csv file and store column value in variable

#1 2012-06-15 08:28:10

NitinMunjani
Member
Registered: 2012-04-28
Posts: 33

Iterate csv file and store column value in variable

Tags: [CSV file, iterate]

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------>[2nd subJob]
                                (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

Last edited by NitinMunjani (2012-06-15 08:28:51)

Offline

#2 2012-06-15 08:56:22

dentiston
Guest

Re: Iterate csv file and store column value in variable

Try tAggregateRow and normalize the output.

#3 2012-06-19 10:38:00

NitinMunjani
Member
Registered: 2012-04-28
Posts: 33

Re: Iterate csv file and store column value in variable

Hi dentiston

can you please explain me how do I get my output through tAggregateRow and tnormalize.

Offline

#4 2012-07-16 17:58:27

jonathanbowen
Member
Registered: 2011-05-31
Posts: 21
Website

Re: Iterate csv file and store column value in variable

Hi

Try this:

tFileList [iterate]-> 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


Uploaded Images

Last edited by jonathanbowen (2012-07-16 17:59:01)

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Iterate csv file and store column value in variable

Board footer

Powered by FluxBB