Hello guys
I have a question about writing a expression.If i am using a string function (ex.concatenation),will it be efficient to write derivation directly in column derivation or calculating it first in stage variable and then assigning it to column derivation will work faster
Thanks for your help
Regards
Ulhas
Query about writing expression
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 72
- Joined: Wed Dec 12, 2007 2:29 am
-
- Participant
- Posts: 72
- Joined: Wed Dec 12, 2007 2:29 am
A derivation is a derivation, it won't matter where it is when it comes to how long it takes to be evaluted. As noted, one typically uses a stage variable to do something once and allow it to be reused in multiple places, be it other stage variables or in a column's derivation. That can even be something as simple as resolving a function like CHAR(10) once rather than over and over again for every record.
However, that being said, there are other reasons for using stage variables rather than just re-use. They also allow larger, more complex derivations to be broken down into logic chunks and 'self documented' via the use of intelligent stage variable names. Or even if not all that complex, it can make a job much more readable when you leverage a well-named stage variable in a constraint or derivation rather than the actual 'code' itself. As another example, you might need to check 4 or 5 things to determine if a row is "valid" or not and doing that in a boolean stage variable allows the outgoing constraint to be something like "svIsValid" rather than an awkard if-then-else mess.
However, that being said, there are other reasons for using stage variables rather than just re-use. They also allow larger, more complex derivations to be broken down into logic chunks and 'self documented' via the use of intelligent stage variable names. Or even if not all that complex, it can make a job much more readable when you leverage a well-named stage variable in a constraint or derivation rather than the actual 'code' itself. As another example, you might need to check 4 or 5 things to determine if a row is "valid" or not and doing that in a boolean stage variable allows the outgoing constraint to be something like "svIsValid" rather than an awkard if-then-else mess.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers