Focal Point
When to use .EVAL

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5341072581

September 12, 2006, 10:50 AM
Prarie
When to use .EVAL
I have looked on the Forum and on the IBI tech site...and all of us here are still not sure exactly when to use .EVAL

Does anyone know the Rule? Is there a Rule?
Does it behave different in 5.3.x vs. 7.1.x?

Thanks.... Confused


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
Hi Prarie,

Try the following section from the iWay Stored Procedure Reference 7.1.3 manual (DN3501587.0206): .EVAL Operator

The section is the same in the 5.3.2 version and 7.1.3 version of the manual.

I hope this helps.

Regards,
Jenn
Thanks....I did read that already...and we were still not sure what the actual rule was.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
Prarie,

You use .EVAL when you want FOCUS to parse the value of the &varbiable after it resolves the variable. The examples in the documentation show that the &variable is set to a dialogue manager keyword such as -TYPE or -*. If the .EVAL is not used, FOCUS does not treat the -TYPE or -* as a dialogue manager command. Rather, it will treat it as a literal value.

Another example would be mathematical symbols * / + or -.

-SET &EXP = '*';
-SET &RES = 3 &EXP 5;

The above will not work because FOCUS won't know the value for &EXP is a multiplication sign as ossposed to just an asterisk.

The following will give you the desired result.

-SET &RES = 3 &EXP.EVAL 5;

The above would give you 15.


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
Prarie,

I'm not sure there is a rule defined by IBI, but we do not use .EVAL in comparison operations (EQ,GT,LT, etc.). We do use the .EVAL operator to insert the value of an &var as we are dynamically building code (ie SQL passthru) strings.
Also particularly useful for dynamically commenting out lines of code (for instance setting an &var to -* depending on parameters, where the &var.EVAL starts in column 1)

I have seem the .EVAL operator used in comparisons and it seems to work most of the time, but as I run accross those in code maintenance, I replace them according to the rule above.

Hope this helps,

Kevin


WF 7.6.10 / WIN-AIX
Thanks for the insight. Smiler


In Focus since 1993. WebFOCUS 7.7.03 Win 2003