Page 1 of 1

Pivoting a Single column

Posted: Thu Nov 06, 2008 4:07 pm
by dsdoubt
Hi,

Code: Select all

Input
------
Id| Name
1|aa,bb,cc
2|ee,aa

Code: Select all

Output
-------
1|aa
1|bb
1|cc
2|ee
2|aa
How can I acheive the output from the given input.
What is the best "Restructure" stage that can be used to achieve this?

Posted: Thu Nov 06, 2008 4:14 pm
by chaks
First of AllI would seperate the values based on the delimiter to different columns like

Code: Select all

Input 
------ 
Id| Name,Col1,Col2 
1|aa       ,bb   ,cc 
2|ee       ,aa
then Use a Pivot stage to get your desired output

Posted: Thu Nov 06, 2008 4:46 pm
by ray.wurlod
That's how I would do it too.

Posted: Thu Nov 06, 2008 11:52 pm
by dsdoubt
This requires, finding the maximum column and then strandadizing the layout then Pivot stage.
But there should be a option with some of the restructure stage. :?

Posted: Mon Nov 10, 2008 12:12 pm
by dsdoubt
How can I assign Col1, Col2 on the fly? If the number of columns changes everytime of the run?

Posted: Mon Nov 10, 2008 12:44 pm
by chulett
Setup whatever you think the maximum number of columns are and use Field() to populate each. Filter the empty/null ones out afterwards.