Lookup key expressions

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
Dmitriy
Participant
Posts: 24
Joined: Wed Apr 14, 2010 9:30 pm

Lookup key expressions

Post by Dmitriy »

Hello!
I have faced the following situation with Lookup stage (normal lookup):

My Lookup has a primary link (PL) and a reference link (RL).

Primary link contains a column A1, by which I want to lookup a record through the reference link.

Reference link has two columns B1, B2.

The lookup logic is expected as the following:

PL.A1 = RL.B1 AND PL.A1 = RL.B2

To implement this, i have joined PL.A1 with RL.B1 and PL.A1 with RL.B2 inside the lookup stage with the key type =

For me, it seems like the condition PL.A1 = RL.B1 AND PL.A1 = RL.B2
As the result, i am getting the Fatal Error in the Director log within the lookup stage - My_Lookup:

My_lookup: OFFICE_ID is not a valid field name
BRANCH_CODE is not a valid field name
OFFICE_CODE is not a valid field name
BRANCH_NAME is not a valid field name
OFFICE_NAME is not a valid field name

If i use only one condition - PL.A1 = RL.B1 everything works fine. But in usual there is a need in two conditions together - PL.A1 = RL.B1 AND PL.A1 = RL.B2
How can this be achieved? May be there are some specific features in Lookup stage that require some settings?
Thanks!
Dmitriy
Participant
Posts: 24
Joined: Wed Apr 14, 2010 9:30 pm

Re: Lookup key expressions

Post by Dmitriy »

Also what I have figured out regarding this problem, is that

when I artificially inject a column PL.A2 which is equal (by its type and value) to PL.A1 and then use the following condition in lookup:

PL.A1 = RL.B1 AND PL.A2 = RL.B2

- lookup works with no errors.

Assuming the above info, it seems that there some restriction in ability to use the same primary link column as a key to more than one reference link columns, but I'am not sure.

I hope there some solution for this, because it is not a good way to produce additional columns in primary link which holds the same value just to be able to make a lookup with more than one reference columns.

Thanks for any help!
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

It seems that the Lookup stage doesn't like the same column being used twice for the key. Duplicate your PL.A1 column and then use the original and duplicate for the lookup.
Dmitriy
Participant
Posts: 24
Joined: Wed Apr 14, 2010 9:30 pm

Post by Dmitriy »

ArndW wrote:It seems that the Lookup stage doesn't like the same column being used twice for the key. Duplicate your PL.A1 column and then use the original and duplicate for the lookup. ...
Hello ArndW !

We have posted simultaneously at 3:50 am :)
Thanks for Your reply, if there would be no better solution for this, it will make me to follow the creation additional artificial columns with same values to bypass the using of primary link column as a key twice.
Thanks for your help.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I don't know about 3:50am, my watch read 11:50am and the sun is shining... 8)
Dmitriy
Participant
Posts: 24
Joined: Wed Apr 14, 2010 9:30 pm

Post by Dmitriy »

ArndW wrote:I don't know about 3:50am, my watch read 11:50am and the sun is shining... 8) ...
Yes you are right ) I should have said about equality in minutes of the posts :)
But our opinion on this subj is helpful, in this way it works.
If there will be no any workable solutions, I'll mark the topic as resolved.
Thanks!
Post Reply