Page 1 of 1

Transformation Logic

Posted: Fri May 09, 2008 2:02 am
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

Posted: Fri May 09, 2008 4:34 pm
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.