Page 1 of 1

How do I split a input row into multiple output rows

Posted: Mon Mar 20, 2006 3:15 pm
by Champa
Hey guys,

The input file is as below

1|711,729a,726|h711_729A_726_ppsp|H323

1|711,729a,726|s711_729A_726_ppsp|SIP

2|729ab,726,711|h729AB_726_711_ppsp|H323

2|729ab,726,711| s729AB_726_711_ppsp|SIP

The output file should be as below.

Codec_Descriptor_ID=1|Codec_Descriptor_Value=711

Codec_Descriptor_ID=2|Codec_Descriptor_Value=726

Codec_Descriptor_ID=3|Codec_Descriptor_Value=729a

Codec_Descriptor_ID=4|Codec_Descriptor_Value=729ab

Any suggestions???

Thx

Re: How do I split a input row into multiple output rows

Posted: Mon Mar 20, 2006 3:26 pm
by gateleys
What's your input stage? Flat-file? What about your output stage?

gateleys

Posted: Mon Mar 20, 2006 3:31 pm
by Champa
Both sequential files

Posted: Mon Mar 20, 2006 4:12 pm
by DSguru2B
hi champa,
ok if i understood your question correctly then do this,
specify four columns in your source seq. file
col A , col B, col C and col D
specify the quote character as 000
have a link going from this seq. file stage into a transformer.
pull col B into a stage variabe and give the derivation as

Code: Select all

Field(In.col B,",",1):char(010):Field(In.col B,",",2):char(010):Field(In.col B,",",3)
in the above code, char(010) is the value for a line terminator in unix.
have this link going into a seq. file stage.
in this seq file stage, specify both the delimiter and quote character as 000.
you will see that your output will have the following values

Code: Select all

711
729a
726
711
729a
726
729ab
726
711
729ab
726
711

now you have all those values, just repeating themselves. Now you only want discrete of those values.
you can pass that through a hash file, into a sec. transformer, where you can attach the column Codec_Descriptor_ID, use it as an identity column and finally into the target seq. file
so if you did all that correctly, your target file should have the require output that you desire.
i hope it helps
cheers

Posted: Mon Mar 20, 2006 4:21 pm
by DSguru2B
forgot to mention one point, make sure the delimiter you specify in your source seq. file stage is " | " and not a " , ".
:)

Posted: Mon Mar 20, 2006 6:19 pm
by rasi
Champa

Explain the logic of how do you get this result. The logic is not mentioned clearly in your question
The output file should be as below.

Codec_Descriptor_ID=1|Codec_Descriptor_Value=711

Codec_Descriptor_ID=2|Codec_Descriptor_Value=726

Codec_Descriptor_ID=3|Codec_Descriptor_Value=729a

Codec_Descriptor_ID=4|Codec_Descriptor_Value=729ab

Posted: Mon Mar 20, 2006 6:30 pm
by I_Server_Whale
I agree. It is a vague and ambigous presentation of your problem. It would help if you could verbalize a little more and also about your file-formats.