overriding evaluate result at runtime Possible???

Jun 5, 2009 at 7:51 AM
Edited Jun 6, 2009 at 10: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

ie

' 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

 

 

 

 

 

 

 

 

Coordinator
Jun 9, 2009 at 4:43 AM

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