Lookup using Stage Variable

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
cosec
Premium Member
Premium Member
Posts: 230
Joined: Tue May 08, 2007 8:10 pm

Lookup using Stage Variable

Post by cosec »

I want to do a lookup based on a stage variable and not based on any of the columns in the input link. Is it possible ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No. Use the ellipsis in the Key Expression editor for a list of valid contributors.

You could pass the stage variable down a link and use it in the lookup of a downstream transformer, however. But that would just put you back to doing the look up from the input link. :wink:
-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 »

Yes, of course it's possible. You need one Transformer stage to generate the stage variable value. That goes on the output link as an extra column along with all the columns from in input link. In a separate, downstream Transformer stage you perform the lookup, using the extra column as the reference key.

It is not possible to do it in the one Transformer, because all input links are processed before stage variables are evaluated.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Re: Lookup using Stage Variable

Post by sachin1 »

i agree with ray.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:roll:

Ray said exactly what I said, just in the reverse order. And the answer to the question as asked is still 'no'.
-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 »

Yair, but before I'd seen your post. C'est la vie.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Tsk, tsk... that's what happens when you post into a thread without reading the replies first. :lol:
-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 »

Suspect I already had it open when you replied.

This is an example of why optimistic locking strategies are not perfect.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
aakashahuja
Premium Member
Premium Member
Posts: 210
Joined: Wed Feb 16, 2005 7:17 am

Post by aakashahuja »

Or... if you already know what the value of your stage variable is going to be!! And if that value is always going to be a constant for each run of the job... then, you can simply hard code that value to the left pane against the columns to be looked up on the right, for the lookup link inside the transformer..

Cheers
Aakash
L'arrêt essayant d'être parfait… évoluons.
aakashahuja
Premium Member
Premium Member
Posts: 210
Joined: Wed Feb 16, 2005 7:17 am

Post by aakashahuja »

Or... if you already know what the value of your stage variable is going to be!! And if that value is always going to be a constant for each run of the job... then, you can simply hard code that value to the left pane against the columns to be looked up on the right, for the lookup link inside the transformer..

Cheers
Aakash
L'arrêt essayant d'être parfait… évoluons.
Post Reply