Page 1 of 1

Expression Passed as Job Parameter is not working

Posted: Wed May 27, 2009 3:59 pm
by DS4DRIVER
I have prepared an Expression via Unix script (dynamic in nature based on the number of records in a table that drives the expression) that needs to be used in the Transformer Stage of a job. This expression does not return the result that i am looking for, instead, just outputs the expression itself.

In the Transformer Stage i have the following Stage Variables.
lnk_ALLFIELDS.DOLLAR_VAL --> svDollarValue (Where DOLLAR_VAL is the Input Column in link lnk_ALLFIELDS)
WGHT_EXPRESSION --> svWeight (Where WGHT_EXPRESSION is the Job Parameter).

The Run Time value of WGHT_EXPRESSION is: If (svDollarValue > 1000000 And svDollarValue < 1000000000) Then 100 Else If (svDollarValue > 100000 And svDollarValue < 999999) Then 30 Else If (svDollarValue > 50000 And svDollarValue < 99999) Then 20 Else If (svDollarValue > 30000 And svDollarValue < 49999) Then 10 Else If (svDollarValue > 10000 And svDollarValue < 29999) Then 5 Else If (svDollarValue > 1000 And svDollarValue < 9999) Then 0 Else 0

I was thinking that svDollarValue in the expression would be replaced by the value of Stage Variable svDollarValue. But, i do not see this happening.

When i capture output of svWeight to a Output Column and view the result, it just consists of the Expression that was passed (If (svDollarValue > 1000000 And svDollarValue < 1000000000) Then 100 Else If (svDollarValue > 100000 And svDollarValue < 999999) Then 30 Else If (svDollarValue > 50000 And svDollarValue < 99999) Then 20 Else If (svDollarValue > 30000 And svDollarValue < 49999) Then 10 Else If (svDollarValue > 10000 And svDollarValue < 29999) Then 5 Else If (svDollarValue > 1000 And svDollarValue < 9999) Then 0 Else 0)

Ex:
If lnk_ALLFIELDS.DOLLAR_VAL --> svDollarValue = 2073522
Since svDollarValue falls in the range (svDollarValue > 1000000 And svDollarValue < 1000000000) Then 100, i was expecting the output to be 100.

But, the conditional expression does not execute (in other words, it does not use svDollarValue Stage Variable).

Is there a way to make this work?

Thanks

Posted: Wed May 27, 2009 4:15 pm
by chulett
Sorry, but that's not going to work. It won't do the multiple 'levels' or iterations of substitution / resolution you're looking for. It does turn your job parameter into the string you passed in but it's just a string at that point, it doesn't then know it then needs to resolve the stage variables. It's the same issue people find when they put a job parameter's #name# inside another job parameter's value. :(

Posted: Thu May 28, 2009 3:13 am
by Sainath.Srinivasan
Is the If-Then-Else combination be the same always with with different range checks?

Alternatively use server jobs.

Posted: Thu May 28, 2009 6:59 am
by chulett
'Alternately use Server jobs' how? This isn't a problem just for PX, hence the question.

Posted: Thu May 28, 2009 7:33 am
by Sainath.Srinivasan
EVAL should do the trick.

Posted: Thu May 28, 2009 9:13 am
by DS4DRIVER
The If Else statement is prepared by reading a Table. The number of ranges vary. Today the number of ranges can be 5, tomorrow 6 etc. So, using a Unix script, i prepare this Statement and Pass it to the Job. But, i was not sccessful of what i thought.

Any Ideas?

Thanks.

Posted: Thu May 28, 2009 10:07 am
by DS4DRIVER
If I have to use EVAL where do i use it?

Thanks

Posted: Thu May 28, 2009 10:13 am
by chulett
I don't see how it would help at all.