We have moved to www.dataGenX.net, Keep Learning with us.

Thursday, July 11, 2013

Convert a single row into multiple rows ( horizontally pivoting ) with Pivot stage ?

In this example, the Pivot Enterprise stage is set up to horizontally pivot some data.
You can generate a pivot index that will assign an index number to each row within sets of horizontally pivoted data. The following tables provide examples of data before and after a horizontal pivot operation.

Input Data

Output Data
101,Yamada, 1245.00,0
101,Yamada, 1765.00,1
101,Yamada, 1934.00,2
103,Anderson, 1498.00,0
103,Anderson, 1287.00,1
103,Anderson, 3298.00,2
100,Smith, 1234.00,0
100,Smith, 1456.00,1
100,Smith, 1578.00,2
102,Xing, 2190.00,0
102,Xing, 1287.00,1
102,Xing, 2054.00,2


a) This is the job design.

b) Input File settings

c) Input File columns

d) The following screen capture shows the settings for a horizontal pivot on the Pivot Definition tab of the Stage page.

e) For selecting the column on which we have to use Pivoting, follow below steps
i) First, create a new column, Q1 here, select SQL type, length, scale etc.
ii) Now come to derivation part, click on far right in the derivation column, it will browse the columns available as  input.

 iii) Now, select the column on which you need pivot, and click on > arrow to send in Selected Column

iv) Click OK, you will get the ScreenShot d.

f) Output Column mapping in Pivot stage

g) OutPut File columns

I hope, design is clear to you all. Please drop your comments if have any questions.