In this article you will learn how to convert columns to rows.
This procedure was written with:
In this procedure the following source file will be converted:
Id;Name;Sex;Surgery 1;Shong;M;Y 2;Ross;M;Y 3;Elise;F;N
The columns become rows as follows:
Id;Question;Answer 1;Name;Shong 1;Sex;M 1;Surgery;Y 2;Name;Ross 2;Sex;M 2;Surgery;Y 3;Name;Elise 3;Sex;F 3;Surgery;N
Install the custom component tUnpivotRow. Please refer to Installing a custom component for instructions.
Create a simple Job as follows:
Because both columns (Pivot_key and Pivot_value) are read only in the tUnpivotRow component, you must change the column names in tMap to map to the target schema.
Execute the Job, and tLogRow (display results with table model) will output the following result to the console: