Page 1 of 1

Split a record into multiple records

Posted: Thu Mar 31, 2011 7:05 pm
by rajendharreddy
Hi,

I have a requirement as mentioned below. I need to split one record into multiple columns as shown below.

Input Record
---------------
Col1
a,b,c,d
d,e
f,g,h

Col1|Col2|Col3|Col4
a|b|c|d
d|e
f|g|h

Could anyone help me out on the above.

Thanks in advance.

Regards,
Raj

Posted: Thu Mar 31, 2011 8:00 pm
by ray.wurlod
Concatenation in Transformer stage.

Column Export stage.

Posted: Fri Apr 01, 2011 12:41 pm
by soumya5891
You can use a transformer stage variable also to split the records

Posted: Mon May 16, 2011 7:36 am
by senthil_k
Use Field Function in transformer

Posted: Mon May 21, 2012 12:52 am
by vamsi.4a6
ray.wurlod wrote:Concatenation in Transformer stage.

Column Export stage. ...

My idea to get the required output is as follows

1)Input is read as once column as id

2)count the no of delimiters in each record and Concatenatinating required delimiters for example for second record input is -d,e so i am adding d,e,, since the no of fields in the output is four.


3)Then using column import stage to parse the one column into four columns


Just want to know how to get the required o/p with Concatenation and Column Export stage.Please correct me if i am wrong?

Posted: Mon May 21, 2012 5:59 am
by priyadarshikunal
approch is dependant on what you want. Are you going to write it directly to a file then you just need to replace the delimiters from comma to pipe and add a header for column names using convert().

if you need to split the incoming column in four columns then you can read it in single column and feed it to column export stage.

It can also be done in a transformer to split the columns using field function and then you may need to do null handling for missing values if performing the task in stage variables.

Posted: Mon May 21, 2012 7:48 am
by vamsi.4a6
@priyadarshikunal

if you need to split the incoming column in four columns then you can read it in single column and feed it to column export stage.


Doubt:for splitting the column one from i/p to four columns we will use column import stage not column export stage.please correct me if i am wrong?

Posted: Mon May 21, 2012 10:06 pm
by vamsi.4a6
vamsi.4a6 wrote:@priyadarshikunal

if you need to split the incoming column in four columns then you can read it in single column and feed it to column export stage.


Doubt:for splitting the column one from i/p to four columns we will use column import stage not column export stage.please correct me if i am wrong?
Could anybody please clarify on the above point for column import stage?

Posted: Mon May 21, 2012 10:16 pm
by chulett
What above point, exactly? If you are unsure which 'direction' the Column Import or Column Export stages go, why not simply check the documentation? It is stated quite clearly there.