Page 1 of 1

How to Vertical Pivot

Posted: Tue Mar 18, 2014 3:32 pm
by MrBlack
Can anyone explain how to do a vertical pivot for the server addition? All my searches are turning up example for the parallel edition. I'm assuming the pivot stage can do horizontal and vertical. I've used it for horizontal pivoting, so I've been testing putting different values in the derivation of the output of the stage.

To help illustrate here' the source format:

Code: Select all

ID_Column,Column_Name,Column_Value
1,First_Name,Joe
1,Last_Name,Smith
1,Color,Blue
2,First_Name,Amy
2,Last_Name,Joe
2,Color,Green
And the destination format:

Code: Select all

ID_Column,"First_Name","Last_Name","Color"
1, Joe, Smith, Blue
2, Amy, Joe, Green

Posted: Tue Mar 18, 2014 3:48 pm
by ray.wurlod
The server job Pivot stage can only do horizonal pivot. To perform vertical pivot in a server job use Sort, Transformer and Aggregator stages. Use stage variables to construct the output lines, and an Aggregator stage to preserve only the Last of each group.

Reply

Posted: Tue Mar 18, 2014 5:10 pm
by ssnegi
In transformer put constraints for First_Name, Last_Name and Color and output them on three seperate links. Then use Link Collector stage to sort/merge them together into one record per ID_Column group.