overriding evaluate result at runtime Possible???

Jun 5, 2009 at 6:51 AM
Edited Jun 6, 2009 at 9:17 PM

hi eugene,

IS it Posible to change the expression for a variable at runtime, or

change the return value when evaluating an expression


' first iteration of formula

x = 2.5 , y =  3 , z = 1

 Dim e As IGenericExpression(Of Double) = context.CompileGeneric(Of Double)(x+y+z)

tmpexp = e

vc.Add(sVarName, e)

e.evaluate   (returns 2.5+3+1) = 6.5

second iteration

I Need to overrride some how the e.evaluate result depending on a value read from database

e.OverrideEvaluateResult = True

e.OverrideResult = 1234.0

e.evaluate   (returns 1234.0) instead of 6.5

How can I accomplish this behavior


Thanks For your help

Arturo Ruvalcaba









Jun 9, 2009 at 3:43 AM

You could always have the expression evaluate a function and inside the function you return the desired result based on a flag.