Rows into Columns

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
vcamsgc
Premium Member
Premium Member
Posts: 2
Joined: Mon Jan 26, 2009 4:34 pm
Location: Farmington Hills

Rows into Columns

Post by vcamsgc »

For Every unique key column value, i need to get the 1st NotNull values of every column based upon the source priority.

SOURCE File:

Key Source Col1 Col2

2000 A NULL DEF
2000 B NULL NULL
2000 C XYZ NULL

2001 A PQR NULL
2001 C NULL RXB
2001 D OIO ABC

2002 A NULL NULL
2002 B IOP NULL
2002 C NULL NULL
2002 D KEF ABE

TARGET output like below.

2000 A XYZ DEF
2001 A PQR RXB
2002 A IOP ABE


Thanks
Vcamsgc
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard.

This is most easily accomplished, once data have been sorted by the key, in a Transformer stage using stage variables to detect whether a non-null value has already been processed for the current key. As many rows are output as are input, into a Remove Duplicates stage that allows only the last row from each group to pass.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vcamsgc
Premium Member
Premium Member
Posts: 2
Joined: Mon Jan 26, 2009 4:34 pm
Location: Farmington Hills

Post by vcamsgc »

ray.wurlod wrote:Welcome aboard.

This is most easily accomplished, once data have been sorted by the key, in a Transformer stage using stage variables to detect whether a non-null value has already been processed for the current key. As many rows are output as are input, into a Remove Duplicates stage that allows only the last row from each group to pass.

how to check not null values passed or not in particular column for group of key values?
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

IsNull() function, IsNotNull() function, NullToValue() function, to name just three.
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