Summation in transformer stage

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
jani
Participant
Posts: 8
Joined: Tue Aug 26, 2008 1:24 am

Summation in transformer stage

Post by jani »

Hi All,

I am trying to sum a column without grouping.I need the summation as a single value so that i can use that as variable in calculation.Please help me out.

Thanks in advance.
aj
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Re: Summation in transformer stage

Post by sachin1 »

stage variable will help............

stage variable = stage variable + input column value
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Re: Summation in transformer stage

Post by vivekgadwal »

sachin1 wrote:stage variable will help............

stage variable = stage variable + input column value
Yeah, this should work. Don't forget to initialize the stage variable to whatever value you want (ex. '0').
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
jani
Participant
Posts: 8
Joined: Tue Aug 26, 2008 1:24 am

Re: Summation in transformer stage

Post by jani »

sachin1 wrote:stage variable will help............

stage variable = stage variable + input column value
Hi Sachin,
Sorry i did not get u.For example if Quantity is a column then i want sum(Quantity) as a single value irrespective of the other columns.

Thanks
aj
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Re: Summation in transformer stage

Post by sachin1 »

jani wrote:
sachin1 wrote:stage variable will help............

stage variable = stage variable + input column value
Hi Sachin,
Sorry i did not get u.For example if Quantity is a column then i want sum(Quantity) as a single value irrespective of the other columns.

Thanks
hello dear in stage variable palette define one variable for example sum_quant, in derivation put sum_quant + input_column_name.

in transformer put derivation for column Quantity as stage variable.

Derivation column name
sum_quant Quantity.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You're all crazy! Use an Aggregator stage to sum the column. Specify no grouping columns. It will use no memory (apart from the actual running sum) and be very fast. And it will require no "programming".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply