Page 1 of 1

convert column data in to rows

Posted: Thu Oct 18, 2012 4:27 am
by cherry
Hi All,

I have the below scenario and my pinput data is as below

Input
-----
Id, Name
1, r;b;c
2 a;d;g;h;j

Name field has data which is ';' delimited but it is one record

I would like my input to be as shown below:

Output
------
Id, Name
1,r
1,b
1,c
2,a
2,d
2,g
2,h
2,j

Any help here please.

Thanks
Cherry

Posted: Thu Oct 18, 2012 4:31 am
by ray.wurlod
Column Import stage to split the delimited field into columns then a Pivot stage.

Posted: Thu Oct 18, 2012 5:31 am
by cherry
Hi Ray,

The name field is not fixed with number of delimiter's say for one record it might have 5 delimiters and other row would have more than 5. In this case iam not sure if column import stage will work.

Thanks
Cherry

Posted: Thu Oct 18, 2012 6:41 am
by bhasds
Hi Cherry,

This may be possible through loop variable in transformer stage.

1.In stage variable-
Name SV1
2. In loop variable-
Loop condition-

Code: Select all

@iteration<=DCount(SV1,";")

Code: Select all

Field(SV1,";",@iteration)             LV1
3.In derivation map the ID directly from input and the take the output of LV1 for Name.

Please let me know if I am wrong.

Posted: Thu Oct 18, 2012 6:42 am
by chulett
Do you know the maximum number of delimited values? If so, code for that.