Page 1 of 1

converting single column to single row

Posted: Tue Aug 05, 2008 10:04 pm
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

Posted: Tue Aug 05, 2008 10:13 pm
by ray.wurlod
Derive field0 as InLink.field0

Posted: Tue Aug 05, 2008 10:55 pm
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

Posted: Wed Aug 06, 2008 1:15 am
by ray.wurlod
Do what you're doing, then pass the results through an Aggregator stage selecting the Last record for each key.

Posted: Wed Aug 06, 2008 1:16 am
by ray.wurlod
Do what you're doing, then pass the results through an Aggregator stage selecting the Last record for each key.

Posted: Wed Aug 06, 2008 3:14 am
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.

Posted: Wed Aug 06, 2008 7:01 am
by ray.wurlod
Do what I said. It will work.