Page 1 of 1

splitting sub records!!!

Posted: Fri Jul 23, 2010 10:46 am
by allavivek
Hi All,

I was trying to split subrecords as below..

Code: Select all


result    first         second
1        (1,aaa,bbb,)   (3,aaa,bbb)

I was using promote subrecord stage...i can only give one parent column in this stage(first) but iam having two parent columns(first and second) ....Another question is how should be the output columns given???

Re: splitting sub records!!!

Posted: Fri Jul 23, 2010 12:15 pm
by DSShishya
Its kind of difficult to understand your requirement. Can you please elaborate more or put the records and result in a orderly manner?.

Re: splitting sub records!!!

Posted: Fri Jul 23, 2010 12:39 pm
by allavivek
DSShishya wrote:Its kind of difficult to understand your requirement. Can you please elaborate more or put the records and result in a orderly manner?.
i/p data is below...actually its an output data from compare stage...

Code: Select all

result     first     last
1      (1,aaa,bbb)  (3,aaa,bbb)
1      (3,fff,ggg)    (5,ffff,gggg)
o/p should be

Code: Select all

result   col1 col2 col3 col4 col5 col6
1          1      aaa bbb   3   aaa  bbb
1         3      fff     ggg   5   ffff   ggg

Re: splitting sub records!!!

Posted: Fri Jul 23, 2010 12:58 pm
by DSShishya
Looks very simple.

Use the String function "Index" on the "first" and "last" columns of the input in order to get the desired output in col2,col3...

Refer the developer's guide for syntax on the "Index" function.

Re: splitting sub records!!!

Posted: Fri Jul 23, 2010 1:52 pm
by DSShishya
I'm sorry, that would be the "Field" function, not the Index.

Posted: Fri Jul 23, 2010 4:00 pm
by ray.wurlod
Two subrecords ---> two Promote/Split Subrecord stages.