Transformation Logic

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

Post Reply
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Transformation Logic

Post by prasson_ibm »

Hi All,
I have two col as input:-
col1:-depth
col2:-amount
and records are like this
depth amount
1,10
1,20
2,20
3,30
3,40
4,100
3,100
4,50
4,50
2,200
3,200
but i want output as:-
If Depth =1, then amount = amount corresponding to it ( ie depth 1)+ amount until u encounter a row with depth =1 again break;
If Depth =2, then amount = amount corresponding to it ( ie depth 2)+ amount u encounter a row with depth =2 again break;
If Depth =3, then amount = amount corresponding to it ( ie depth 3)+ amount u encounter a row with depth =3 again break;
If Depth =4 then amount = amount corresponding to it ( ie depth 4) break;

for ex:-
depth amount total
1,10 total=10
1,20 total=20+20+30+40+100+100+50+50+200+200
2,20 total=20+30+40+100+100+50+50
3,30 total=30
3,40 total=40+100
4,100
3,100
4,50
4,50
2,200
3,200
Pls help me if u find any logic ..................
thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If there is a small, finite number of col1 (depth) values you could accumulate/reset in a Transformer stage variable for each. Output only the stage variable for the current value of depth. Perhaps use four outputs into a Funnel stage.
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