Aggregator transformation

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

ahmedwaseem2000
Premium Member
Premium Member
Posts: 145
Joined: Fri Sep 15, 2006 12:23 pm

Post by ahmedwaseem2000 »

keshav0307 wrote:you can get the result by using combination of a SORT and transformation Stage.......
from file Sort on F1 Asc, F2 desc;

In Tnasform stage declare two stage variable VNext and VPriv

VNext=F1
Vpriv=Vnext

have two output from tansform

1st link constraint Vpriv<>Vnext
2nd link constraint Vpriv=Vnext
I am sorry!!! But the logic failed. could you please suggest me a new one????
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

it is tested one, there may be some mistake you are doing:

the order of defining stage variable is very important, i just noticed it was wrong earlier. try this

you can get the result by using combination of a SORT and transformation Stage.......
from file Sort on F1 Asc, F2 desc;

In Tnasform stage declare two stage variable VNext and VPriv

Vpriv=Vnext
VNext=F1

have two output from tansform

1st link constraint Vpriv<>Vnext
2nd link constraint Vpriv=Vnext
hxl208310
Participant
Posts: 1
Joined: Thu Sep 21, 2006 7:49 am

Post by hxl208310 »

I think it's better to avoid using transformer. you can use 'remove duplicate' stage.
Pls find the difference based on keshav0307's method.

your data is like

F1 F2 F3
---------------
1 2 3
1 4 2
6 7 8
6 9 4

after sorting you will get

F1 F2 F3
---------------
1 4 2
1 2 3
6 9 4
6 7 8


remove duplicate be setting F1 as Key, and choose 'get first record' method to remove duplicate.


F1 F2 F3
---------------
1 2 3
6 7 8
hxl
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

Yes remove duplicate will work,
as i and Ray.Wurlod mentioned earlier, rule is same as remove duplicate.

partition and sort on on F1 asc, F2 Desc
and keep 1st
or
partition and sort on on F1 asc, F2 Asc
and keep last
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Post by vijayrc »

ahmedwaseem2000 wrote: Thanks keshav, i will try that tomorrow and let you know how it goes. And Finally can i conclude that each column that is passed through aggregator has to be either grouped or aggregated????
Yes..anything from the Input of Aggregator to get to Output of Aggregator should either be GROUP column[s] or the AGGREGATE columns. Correct me if I'm wrong.
Post Reply