Help with Lookup Logic

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
mac4rfree85
Participant
Posts: 126
Joined: Thu Jul 01, 2010 11:39 pm

Help with Lookup Logic

Post by mac4rfree85 »

Hi Guys,

My lookup table has 15 columns. My source table also have those 15 columns.

I need to do the lookup only when the column is having value instead of Null Values.

For an example:
Lookup table:

Code: Select all

1  2  3    4    5    6    7    8    9    10   Key
A  B  NULL NULL NULL NULL NULL NULL NULL NULL  1
A  B  NULL Y    NULL NULL NULL NULL NULL NULL  2
C  A  NULL D    E    NULL NULL NULL NULL NULL  3
E  R  A    T    NULL NULL NULL NULL NULL NULL  4
When my source table is having values A and B for Col1 and Col2, i should consider only the first two Column as the lookup and retrieve the key 1.
If my source table is having values A and B for Col1 and Col2 and Y as col4, then i should consider the three columns col1,col2 and col4 and retrieve the key 2.
If my source table have C and A as Col1 and col2, then i need to consider col1, col2, col4 and col5 for lookup and retrieve the key 3.

I hope i made myself clear. Could you please help me with my design.

Cheers!!!!!
Mac4rfree
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Multiple lookup stages, one for each of the combinations listed.
-craig

"You can never have too many knives" -- Logan Nine Fingers
cipsy
Participant
Posts: 14
Joined: Wed May 02, 2007 4:59 am

Post by cipsy »

I think you can use, user defined sql in source stage.
Akin AYDIN
Business Intelligence Consultant
paultechm
Participant
Posts: 27
Joined: Wed Jul 25, 2007 2:09 am

Re: Help with Lookup Logic

Post by paultechm »

Concatenate columns 1 to 10 in both source and lookup then perform the lookup based on the concatenated column
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: Help with Lookup Logic

Post by SURA »

Use full outer join.

1. Nulls can be replaced with dummy values to know that it is null
2. Use a TFM and apply whatever the condition you need and get the output
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
Post Reply