Hi all,

I need to evaluate a formula inserted in a field.

Via script I get the field's content (the formula) and I save it in a variable, I substitute the keys (x, y) with current values and I would like to get the calculated result.

I.e. In my field I have the formula: x ≥ ( 6 * y ) and x ≤ ( 8 * y ):

where x = 5 and y = 10 the result return,

5 ≥ ( 6 * 10 ) and 5 < ( 8 * 10 ) ===> False

where x = 75 and y = 10 the result return,

75 ≥ ( 6 * 10 ) and 5 < ( 8 * 10 ) ===> True

How I can do this in a simple way?

Fabio

Sounds like you're already there, but maybe this'll help?:

Evaluate (

Quote (

Substitute (

$expression

; [ "x" ; myXField ]

; [ "y" ; myYField ]

)

)

)

Like I said, it sounds like you're all, or at least most of the way, there, so I'm not sure what part's still giving you trouble. Forgive me if I'm just rehashing what you already know.

The one comment I'd make is that "x" and "y" are pretty generic, so you might want to use something more unique like "<<x>>" just to be sure you don't inadvertently sub something else out in your expression. May be a non-issue in your scenario, though?

HTH

Chris Cain

Extensitech