Page 1 of 1

Use of aggregator stage to sum columns value

Posted: Thu Jan 16, 2014 7:29 am
by swapna07
Hi All,

I have a scenario with sequential file as input data as below:
Name Sub1 Sub2 Sub3
abc 70 80 90
def 50 70 80
ghi 50 80 90

I need to sum the columns sub1+sub2+sub3 and get the value in new column 'Total' in output file as below:
Name Sub1 Sub2 Sub3 Total
abc 70 80 90 240

I tried using transformer but it was cubersome and could not do it, can anyone help how to achieve this using aggregator stage.

Thanks in advance.

Re: Use of aggregator stage to sum columns value

Posted: Thu Jan 16, 2014 7:44 am
by thompsonp
Please let us know what you put as the derivation for the new "Total" column in the transformer.
You are not aggregating rows, rather summing columns, so the aggregator is not going to help in this instance.

Posted: Thu Jan 16, 2014 8:27 am
by chulett
Not really sure how the transformer solution would be cumbersome. All you seem to be doing is putting a new column on the output link and adding up the other three. Yes? :?

Posted: Thu Jan 16, 2014 11:01 am
by swapna07
I wanted to do that with aggregator, is it not possible?
With transformer I included 3 stage variable , but I was not sure how to use it
in the output link so as it sums up the Sub1 Sub2 and Sub3 values on Name key column. Please help!

Posted: Thu Jan 16, 2014 11:37 am
by chulett
You don't need stage variables, just a simple derivation in the new column to add the other three together. And this is not something you can do in the Aggregator, it does sums across rows not within.

Posted: Thu Jan 16, 2014 11:58 am
by swapna07
Alright Craig.Thanks for info, I will try that tomorrow once I go to office, and if I stuck up somewhere I will let you know. Hey btw do we have any way of having Datastage installed at our WAN/LAN home server ?

Posted: Thu Jan 16, 2014 12:37 pm
by chulett
Only if you have a valid license.