Page 1 of 1

Changing the Data format - Columns to Rows

Posted: Wed Sep 01, 2010 9:56 pm
by samratisking
Hi,

I have data like the following:

Col1 ColA ColB ColC ColA1 ColB1 ColC1
--------------------------------------------------------------

123 abc def ghi jkl mno pqr
456 stu vwx yza bcd efg hij



My requirement is that I need the data in the following format:


Col1 ColA ColB ColC
------------------------------
123 abc def ghi
123 jkl mno pqr
456 stu vwx yza
456 bcd efg hij


Could anyone please let me know which stage i need to use and a bit of insight into the logic..

Thanks.

Posted: Wed Sep 01, 2010 10:50 pm
by ray.wurlod
Transformer stage with two outputs followed by a Funnel stage. The key goes to both output links. The first three columns go to the first output link, the other three columns go to the second output link.

Posted: Wed Sep 01, 2010 11:11 pm
by samratisking
ray.wurlod wrote:Transformer stage with two outputs followed by a Funnel stage. The key goes to both output links. The first three columns go to the first output link, the other three columns go to the second output ...
Hi Ray,

That's a cool way of doing it. Instead, you think I can use a Copy stage and Funnel stage to funnel the data into single output..? Is there any particular need to use the Transformer here?

Thanks.

Posted: Wed Sep 01, 2010 11:39 pm
by ravireddy25
Hi,
No Need Transformer stage ,you can use copy stage ,have two output links and rename the 2nd link column names to first link column names before funneling.

Posted: Thu Sep 02, 2010 12:35 am
by ray.wurlod
Excellent.

(My server job background came through for a bit, there.)

Posted: Thu Sep 02, 2010 12:45 am
by samratisking
ravireddy25 wrote:Hi,
No Need Transformer stage ,you can use copy stage ,have two output links and rename the 2nd link column names to first link column names before funneling.
Cool.. That's exactly.. what i had in mind. I mean, the Funnelling wont work if I dint. Thanks..

Posted: Thu Sep 02, 2010 12:47 am
by samratisking
ray.wurlod wrote:Excellent.

(My server job background came through for a bit, there.) ...
It's the same with me. It's just the necessity that I have to decrease the complexity of the job. I am from server jobs background too. Thanks Ray.

Posted: Thu Sep 02, 2010 6:09 am
by samratisking
Hi,

Can we do all these operations using a pivot stage??

Posted: Thu Sep 02, 2010 10:22 am
by way246
samratisking wrote:Hi,

Can we do all these operations using a pivot stage??
Yes, it's possible

Posted: Thu Sep 02, 2010 5:29 pm
by ray.wurlod
Only if you combine the triplets of columns into single columns (then back again into separate columns after pivoting if needed).