Page 1 of 1

Pivoting data to defined columns based upon key column

Posted: Thu Nov 09, 2017 6:38 am
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...

Posted: Fri Nov 10, 2017 5:09 pm
by ray.wurlod
Welcome aboard. Do investigate the Pivot stage, which can effect both horizontal and vertical pivoting.