Split a record into multiple records
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 46
- Joined: Tue Aug 21, 2007 5:39 am
- Location: Bangalore, India
Split a record into multiple records
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
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
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 152
- Joined: Mon Mar 07, 2011 6:16 am
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?
Last edited by vamsi.4a6 on Mon May 21, 2012 1:45 am, edited 1 time in total.
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
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.
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.
Priyadarshi Kunal
Genius may have its limitations, but stupidity is not thus handicapped.
Genius may have its limitations, but stupidity is not thus handicapped.
Could anybody please clarify on the above point for column import stage?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?