Page 1 of 1

Where does logic go for lookup conditions

Posted: Tue Jan 08, 2008 11:05 am
by JBONSER
I've been tasked with writing ETL server jobs using 1 source table & 3 lookup tables. I'm getting multiple results & DS is writing the 1st record to all fields in the output. My limited previous experience was with 6.0. Does the logic go in the transform stage under constraints or in the After of each input stage. The latest training class was cancelled & I cannot find the tutorial for DS 7.5. Reference material is clear as to how to do lookups. Please help.

Thanks,
Judy Bonser

Posted: Tue Jan 08, 2008 11:16 am
by ArndW
Judy,

what are you trying to do? Do you want n-output rows or 1 output row per input row on your lookups?

Here is what I'm trying to lookup

Posted: Tue Jan 08, 2008 12:21 pm
by JBONSER
Source table has SOURCE_ID - ABC and DEF
Lookup table has SOURCE_ID 1 SOURCE_DESC "ABC",
SOURCE_ID 2 SOURCE_DESC "DEF"

If source.SOURCE_ID = lookup.SOURCE_DESC then return lookup.SOURCE_ID
It should one source_id per record but DS is only finding the 1st record in the table & writing it to all records.

Thanks,
Judy

lookup code

Posted: Tue Jan 08, 2008 12:22 pm
by JBONSER
ArndW wrote:Judy,

what are you trying to do? Do you want n-output rows or 1 output row per input row on your lookups?


Here it is......
Source table has SOURCE_ID - ABC and DEF
Lookup table has SOURCE_ID 1 SOURCE_DESC "ABC",
SOURCE_ID 2 SOURCE_DESC "DEF"

If source.SOURCE_ID = lookup.SOURCE_DESC then return lookup.SOURCE_ID
It should one source_id per record but DS is only finding the 1st record in the table & writing it to all records.

Thanks,
Judy

Posted: Tue Jan 08, 2008 12:29 pm
by ArndW
In the transform, the column "lookup.SOURCE_DESC" should be marked as a KEY field and the value of "source.SOURCE_ID" should be in the key expression.

Posted: Tue Jan 08, 2008 3:24 pm
by ray.wurlod
DataStage server jobs will only ever return the first match unless you enable multiple row return, which you can only do if the stage on the other end of your reference input link is an ODBC stage or a UV stage. Otherwise you need to find some other strategy, such as performing an outer join in the database itself.

Thank you all.

Posted: Wed Jan 16, 2008 5:08 pm
by JBONSER
I was able to resolve the issue using Oracle8i stage but I opted for hash files for the lookups instead due to performance. As long as I had the bind parameters correct. Thank you all for your assistance. Have a great day.
Judy :D