Page 1 of 1

Rows to Columns

Posted: Wed Mar 23, 2011 1:23 am
by devidotcom
Hi All,

I have a scenario to handle. Please suggest approach to design the job.

Input:
Column1 Column 2 Column3
4321 X1 3
4321 X2 4
4321 X3 6

Output Required:
Column1 Column2 Column3 Column4
4321 3 4 6

The source is dynamic where the column2 and column3 can have new values for Column1 indicating the columns output must increase accordingly.


Thanks,
Devi

Posted: Wed Mar 23, 2011 1:37 am
by ray.wurlod
This is a horizontal pivot. Use a Pivot stage or a Pivot Enterprise stage.

Posted: Wed Mar 23, 2011 2:11 am
by devidotcom
Well.. guess its vertical pivot.

Please elobrate how to use pivot stage in this case..

Posted: Wed Mar 23, 2011 2:54 am
by abhilashnair
devidotcom wrote:Well.. guess its vertical pivot.

Please elobrate how to use pivot stage in this case..
Vertical Pivot is available only in 8.5

Posted: Wed Mar 23, 2011 3:05 am
by devidotcom
We are using 8.0 how do i implement this here.

Posted: Wed Mar 23, 2011 3:31 am
by ray.wurlod
My bad. 4am start today, it's now 8:30pm. Yes, it's a vertical pivot. Search DSXchange to find out how to do it. It's been explained many times.

Re: Rows to Columns

Posted: Wed Mar 23, 2011 5:56 am
by ds@tcs
use sort stage , there generate change code with cluster or key change , will get 1 for first rows and 0 for duplicates, then use Transfromer stage , there in stage varaible write condition like if change_code=1 then link to new col else concatinate to previous col

hope this helps trywith this
Devi