• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » tAggregateRow to count different values in the same column

#1 2012-06-27 15:22:31

prav_raj
New member
Registered: 2012-05-23
Posts: 8

tAggregateRow to count different values in the same column

Hi All,

i'm trying to load a csv file to Salesforce,

i need to reorganize my data before uploading,
the schema of the input file is like,

Status code, Object Id, Type
1                 oo1           S
1                 oo1           S
10               oo1
10               oo1
50               oo1
50               oo1
15               oo1

My output should be like,
objectID, No of 10's, No of 50's, No of 'S' in type,no of 15's

oo1,2,2,2,1

how do i do this. My idea is like, to split this file into 4 different files based on the status code, use tAggregate to count the status code for each object ID and use tUnite to finally produce the required format. Can anyone tell me what should be the correct approach to do this, i'm pretty new to talend and hence am not familiar with other components that might help me do this.

Will be helpful if someone can suggest some ideas.

Thanks

Offline

#2 2012-06-28 07:42:54

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: tAggregateRow to count different values in the same column

Hi

I think an easy way is to create a job as seen below.
tFileInputDelimited --main --> tJavaRow
            |
OnsubjobOK
            |
tFixedFlowInput --main-- > output component

In tJavaRow, you might use some context variables to save the occurrence times of certain value.
For examaple,
if(input_row.Status==10)
context.No10++;
else if(input_row.Status==50)
context.No50++;

Then in the second subjob, fill all these context variables in tFixedFlowInput.

Regards,
Pedro


Only Paranoid Survive.

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » tAggregateRow to count different values in the same column

Board footer

Powered by FluxBB