Page 1 of 1

grouping data with DS

Posted: Thu May 05, 2005 8:15 am
by Luk
Hi!

I don't know if I entitled this post correctly but I haven't got better idea :)

I have following situation:

colA, colB
1 xxx
1 yyy
1 zzz
2 xxx
2 zzz
3 xxx

and I want to get sth like this

1) xxx,yyy,zzz
2) xxx,zzz
3) xxx

Is it possible to use one of DS stages to do this (maybe transformer) or is the only way, to solve this isue, to use SQL procedure on source database ??

Posted: Thu May 05, 2005 8:23 am
by Sainath.Srinivasan
You can do this in DS by sorting the source and concatenating the desc on identical keys followed by writing into an hash file with the key as your source key.

Re: grouping data with DS

Posted: Thu May 05, 2005 8:32 am
by battaliou
Stage variables are useful here to concact data together. You can set stagevar2 as your source ID and stagevar1 as stagevar2 and compare the differences (stagevar1 created before stagevar2)

I'd send the data to an aggregator and with the 'last' option selected rather than landing to a hash file, this keeps the data memory resident so you get a performance gain.

Posted: Thu May 05, 2005 8:47 am
by Luk
Sainath.Srinivasan wrote:You can do this in DS by sorting the source and concatenating the desc on identical keys followed by writing into an hash file with the key as your source key.
in what way you want to do concatenation?? using stagevariables as battaliou said?? nothing else (exept of stagevar) is coming into my mind!

Posted: Thu May 05, 2005 8:48 am
by Sainath.Srinivasan
Yes. Using stage variables. But writing into an hash file instead of using an agg stage.