Case Insensitive LookUp

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
poorna_76
Charter Member
Charter Member
Posts: 190
Joined: Thu Jul 08, 2004 10:42 am

Case Insensitive LookUp

Post by poorna_76 »

Is it possible to do a "Case Insensitive LookUp" from the HashFile?

I have value coming from PrimaryInputRecord as "Single" and in the ReferenceHashfileRecord as "SINGLE".
I should able to say that the record is matched.

How can i do this? Any thoughts?


Thanks in Advance.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Use UpCase on the incoming value before you do the lookup... or you can do it in the actual derivation of the lookup key.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ameyvaidya
Charter Member
Charter Member
Posts: 166
Joined: Wed Mar 16, 2005 6:52 am
Location: Mumbai, India

Post by ameyvaidya »

When loading the hashed file, load them as all upper-case or lower-case characters(see UPCASE() ) in a prior transformer.

Convert the primary lookup to the same case using the key expression:
UPCASE(in.col)

PX has a case-insensitive lookup option. I havent found one yet in server.
Amey Vaidya<i>
I am rarely happier than when spending an entire day programming my computer to perform automatically a task that it would otherwise take me a good ten seconds to do by hand.</i>
<i>- Douglas Adams</i>
poorna_76
Charter Member
Charter Member
Posts: 190
Joined: Thu Jul 08, 2004 10:42 am

Post by poorna_76 »

ameyvaidya wrote:When loading the hashed file, load them as all upper-case or lower-case characters(see UPCASE() ) in a prior transformer.

Convert the primary lookup to the same case using the key expression:
UPCASE(in.col)

PX has a case-insensitive lookup option. I havent found one yet in server.

Thanks Craig & AmeyVaidya.

But we don't have control over data.


PrimaryInput data can come as one record with LowerCase data and other record as UpperCase data (but definitely not mixed case in a single record)
OR

ReferenceLookup data can come as one record with LowerCase data and other record as UpperCase data (but definitely not mixed case in a single record).

What should we do in that kind of situation.

Thanks in Advance.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Simple, if your lookups can truly be 'case insensitive' then just upcase everything for your keys. Upcase the values in the hashed file. Upcase the values coming in you need to check against the hashed files.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You DO have control over data - you're the ETL person!!! You can determine what to put in a hashed file - apply an Upcase() function as it goes in. You can determine how to lookup those values - use an Upcase() function in the Key Expression in the Transformer. None of this affects the external data.
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