The source table has the columns
The target table has the columns
The source table has two possible values for CostType - when CostType = 1, then the Cost value refers to the AverageCost and when CostType = 2, then the Cost value refers to the ReplenismentCost. So, for every Product there are two rows in the source table and only one row in the target table.
Here's how to use the Pivot Column operator to populate the target table from the source table:
- On the build output tab - you need 3 output attributes (ProductCode, AverageCost, ReplenishmentCost). The input attributes (ProductCode, CostType and Cost) should be automatically derived from the connection to the ReadTable.
- On the specify transfer tab - select to transfer the input attribute ProductCode to the output attribute for ProductCode
- On the specify pivots tab - add a pivot. Pivot from: CostType, Value from: Cost. Select the output attributes AverageCost and ReplenishmentCost
- On the edit output tab - in the "Input - Many Records" section, under the CostType column in the table, replace the AverageCost with 1 and the ReplenishmentCost with 2
Note that Expressor is case sensitive - mismatch in case when specifying attribute names will yield wrong results!