Page 1 of 1

Transformer Expression as a Parameter Value

Posted: Thu Nov 25, 2004 8:52 pm
by vivek_rs
Hi
The expression that goes into a column definition in a Transformer Stage change at every run.
I know the link name and the field names that go into the expression.
I've constructed the expression elsewhere manually/using another tool.
I need to type it as a Job Parameter.
Is there any way of doing this?

Posted: Thu Nov 25, 2004 9:32 pm
by vigneshra
You can very well use job parameters in the column derivation part in a transformer stage. Keep the generated expression in a file and while calling the job, just pass the expressions as job parameters. Use them in your job based on the need.

Vignesh.

Posted: Thu Nov 25, 2004 9:37 pm
by vivek_rs
Hi vigneshra
But it doesn't seem to work!

I have a transformer that has two input columns a and b coming in from a link lnk. The output has a column result. The derivation for result is a job parameter Exp. Now, if I type lnk.a+lnk.b as the value for Exp, all rows in result gets the literal lnk.a+lnk.b[/code]

Posted: Thu Nov 25, 2004 10:13 pm
by kcbland
You need CANNOT use job parameters in the way suggested.

Your derivation has to be CODED into the job design. If you have a few expressions, simply use stage variables to derive the result a few difference ways. Then, use a job parameter to act as the switch which decides which derivation to use.

If you have an infinite variation of derivation, then you have to EXTERNALIZE the transformation. DataStage builds compiled programs, you cannot change the logic on the fly. Therefore, using a function that makes an external call side-steps this issue and provides you the functionality you need at a performance cost.

To do what you want to do, and keep performance, make take a little bit of sophistication. You can generate a function on the fly that does your variable derivation. Use it in the job to derive your particular column. Simply create a function that gets all columns potentially required passed as arguments. Then, prior to running your job, programmatically update the function to derive as needed and recompile the function. Since the job uses the function already, it doesn't need to be recompiled. It will take advantage of the new logic.

This is easier that trying to change job logic programmatically, and Transforms, if changed, also require the job to be recompiled. This is probably the easiest thing to do. Your external rules requirement sounds more like you need to be an external rules engine that is more scalable and usable.

Good luck!

Posted: Thu Nov 25, 2004 11:04 pm
by vigneshra
Thanks Bland !! I too got to know how to parameterise the derivations. Sorry Vivek, I gave you a wrong information.

Vignesh.

Posted: Sun Nov 28, 2004 9:08 pm
by vivek_rs
Thanks a lot guys!
This is working fine.
That helped me a lot...

Posted: Mon Nov 29, 2004 3:29 am
by mtechnocrat
Vivek

few days back I have worked in same issue , just paramerize thye link name and give it in job parameters , i think this will be good .

regards

Hari

Posted: Tue Nov 30, 2004 3:07 am
by vivek_rs
Hi
How do you Parameterize a link name?

Posted: Tue Nov 30, 2004 7:50 am
by kcbland
You cannot, another poster just stated the same errant suggestion.