Pivoting data to defined columns based upon key column

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ThreePhase
Participant
Posts: 1
Joined: Thu Nov 09, 2017 6:10 am

Pivoting data to defined columns based upon key column

Post by ThreePhase »

Hello all! I'm reasonably new to datastage and getting fully stuck in. I wanted to seek your wisdom to identify the best way to impliment a flat file output.

The input table has data spread across multiple records in the following format

ItemID,AttributeID,AttributeValue

There are multiple attributes allocated to each Item, each attribute having a value.

I'm trying to "pivot" the data to end up with a table of the following format

Code: Select all

 ItemID  |    Attribute1   |    Attribute2   | ...
-------------------------------------------------
  Item1  | Attribute1Value | Attribute2Value | ...
  Item2  | Attribute1Value | Attribute2Value | ...
.
.
.
I'm currently using a transformer to output the attribute value to a defined column based on attributeID as a constraint but there's got to be a better way of doing this?

Running on DS 11.5.0.1

Any help much appreciated...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard. Do investigate the Pivot stage, which can effect both horizontal and vertical pivoting.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply