converting single column to single row

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
pxraja
Participant
Posts: 142
Joined: Fri Mar 14, 2008 10:22 am

converting single column to single row

Post by pxraja »

Hi all,

I want to pass the two records present in single column into single row. here is the sample data
input table
field0 field1 field2
101 1 1000
101 2 2000

output table

field0 field1_1 field2_2
101 1000 2000

I tried for in column derivation as....
If field1=1 then field2 else 0 for field1_1
If field1=2 then field2 else 0 for field2_2

but it works for field1=1 since field0 is the key column.

your suggestions will help me to overcome this

thanks in advance
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Derive field0 as InLink.field0
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pxraja
Participant
Posts: 142
Joined: Fri Mar 14, 2008 10:22 am

Post by pxraja »

I want to pass the two records present in single column into single row. here is the sample data
input table
field0 field1 field2
101 1 1000
101 2 2000

output table

Inlink.field0 Inlink.field1_1 Inlink.field2_2
101 1000 2000

I tried for in column derivation as....
If Inlink.field1=1 then Inlink.field2 else 0 for Outlink.field1_1
If Inlink.field1=2 then Inlink field2 else 0 for Outlink.field2_2

but it works for Inlink.field1=1 since Inlink.field0 is the key column.

your suggestions will help me to overcome this

thanks in advance
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Do what you're doing, then pass the results through an Aggregator stage selecting the Last record for each key.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Do what you're doing, then pass the results through an Aggregator stage selecting the Last record for each key.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pxraja
Participant
Posts: 142
Joined: Fri Mar 14, 2008 10:22 am

Post by pxraja »

Hi Ray,

I am taking Field0 as the key column in target database only but it is not unique. its value is repeating. Also I want both the records in
Inlink.field1 and Inlink.field2 into
Outlink.field1_1 and Outlink.field2_2 respectively.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Do what I said. It will work.
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