Page 1 of 1

How to get mutiple records values into a single record value

Posted: Mon Apr 26, 2010 9:15 pm
by mohanraj
I have an input columns in the following format :

columnA column B
111 ABC is working
123 ZYX is working
111 in Pune
123 in Delhi

I would like my output to be

columnA columnB
111 ABC is working in Pune
123 ZYX is working in Delhi


What kind of stage variables will allow me to accomplish the above transformations ?

Thanks in Advance

Posted: Mon Apr 26, 2010 10:17 pm
by ray.wurlod
mohanraj wrote:What kind of stage variables ... ?
Provided data are partitioned on ColumnA and sorted on ColumnA using a stable sort, then you can use standard stage variables to assemble your required output string. Follow the Transformer stage with a Remove Duplicates that allows only the last row of each group to pass.

Posted: Mon Apr 26, 2010 10:33 pm
by ysrini9
Hi ,
I believe below mentioned logic will work.
you can use 4 stage variables in Transformer stage i.e.,
s1:ColumnB
s2:if ColumnA<>s4 then s1 else s3:s1
s3:s2
s4:Column A



Thanks & Regards
Srini Y

Posted: Mon Apr 26, 2010 10:39 pm
by ray.wurlod
What's the purpose of stage variable s1 ?

As far as I can tell, it does not do anything.

Posted: Mon Apr 26, 2010 10:56 pm
by ysrini9
Stage variable 1 for reading ColumnB.

I tried on the above logic ,It's working fine.

Posted: Mon Apr 26, 2010 11:09 pm
by Kryt0n
ysrini9 wrote:Stage variable 1 for reading ColumnB.

I tried on the above logic ,It's working fine.
You missed his point, column B is freely available without assigning it to a stage variable first.

Haven't actually thought about it before but could you have

Code: Select all

s2:if ColumnA<>s4 then ColumnB else s[b]2[/b]:ColumnB
(that is, a reference to itself in its previous incarnation)

PS, suspect a " " needs to go in there too...

Posted: Tue Apr 27, 2010 9:22 pm
by mohanraj
Thanks a lot Everyone :)