Aggregation on a single field

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
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Aggregation on a single field

Post by vinaymanchinila »

Hi I have few columns comming from source, and I need to aggregate only one column and pass the rest of them as it is without applying any logic or aggregation on the rest of the columns.
The isue is when I use the aggregator stage, I HAVE TO select some kind of aggregation on every column , is there a way we can skip it!
Thanks,
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Select from first, last etc
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

The other columns have different values which we need, so select from first or last would eliminate the other records !
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

In that case, how can you group one field alone?

Can you explain your logic and what you intend to achieve?
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

Lets say I have ProdNumbers, Invoice, Sales, Load_Date, all i need is Sum of Invoices, and other fields I need them as it is.
Thanks,
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You must either group by other fields if they are above the Invoice No. in the food chain or supply one of the distinct values for them if they are below.

Can you supply some sample values and how you wish the output to be.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So, you'd want all of these 'non-grouped' fields to have the one grouped field repeated on each record? :? I'm a little lost here.

If this is really what you meant, I'd think you'd need to make two passes through the data - once to get the sum per 'key group' and then another pass to associate that sum with every detail record.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

Yes i got it by using 2 passes!.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Even if you have them in 2 passes, how do you relate them again. Can you let us know the hierarchy. i.e. the relationship between the fields. That is why some sample data set will be helpful.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Think about how you would do it in a query. You'd almost certainly need a temporary table (virtual or physical) in which to store the keys and associated sums, so that you could join this with the original result set.

Well, no surprise, the processing isn't really any different in DataStage; you just get to draw the pictures rather than creating the SQL.
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