Page 1 of 1

Stage Variable

Posted: Mon Nov 22, 2004 7:48 am
by priyaram
Hi
what is meant by stage variable in Transformer and when we need to use that variable

Posted: Mon Nov 22, 2004 8:19 am
by chulett
It's a local variable, something that can come in very handy - at least in Server jobs. Not positive about their role or pros/cons in PX jobs, if any. This post should help. :wink:

Posted: Mon Nov 22, 2004 12:43 pm
by mouthou
the stage variables are some temporary variables defined in the transformer to play internally within it. it is very helpful in terms of complex calculations involving many intemediate calcualtions. if there is a field "FIELD1" for which the calculation is x * y + z. Inturn x,y,z has got some more calculations , you can define x,y and z as the stage variables and define the formula for each of this. And in the transformer, you can use the stage variables to calcualte FIELD1 directly. 8)

And it has got re-usability too. if more than one field has got similar type of calcuations with little bit additions, you can use these stage varibles without re-typing the calculation in the transformer. Also that you can play internally within the stage variable. one calclated variable can be used for another. in that order of the calculatoin is very important.

As far as I know there are no "cons" for stage variables.

Thanks,

Posted: Tue Nov 23, 2004 8:18 am
by biswajit_paul
mouthou wrote:the stage variables are some temporary variables defined in the transformer to play internally within it. it is very helpful in terms of complex calculations involving many intemediate calcualtions. if there is a field "FIELD1" for which the calculation is x * y + z. Inturn x,y,z has got some more calculations , you can define x,y and z as the stage variables and define the formula for each of this. And in the transformer, you can use the stage variables to calcualte FIELD1 directly. 8)

And it has got re-usability too. if more than one field has got similar type of calcuations with little bit additions, you can use these stage varibles without re-typing the calculation in the transformer. Also that you can play internally within the stage variable. one calclated variable can be used for another. in that order of the calculatoin is very important.

As far as I know there are no "cons" for stage variables.

Thanks,
Just to add my 2 cents: The stage variable also can be used in the constraints. If you have a complex constraint, you can derive it in the stage variable and use it in the constraints.

The execution order in the transformer is: stage variable -> Constraints -> derivations.