Boolean expression contained in a variable

Apr 6, 2011 at 10:48 PM

I'm having difficulty getting Flee to evaluate an expression that has been assigned to a variable.

If I plug the expression into this statement:

   IGenericExpression<bool> e1 = context.CompileGeneric<bool>("LEFT(ehandle,1)=\"L\" AND (LEFT(ihandle,1)=\"L\" OR LEFT(ihandle,3)=\"NHI\")");

   bool evalresult = e1.Evaluate();

it works fine.

If I assign the expression to a variable:

string fixedformula = "\"LEFT(ehandle,1)=\"L\" AND (LEFT(ihandle,1)=\"L\" OR LEFT(ihandle,3)=\"NHI\")\"";

and then do this:

   IGenericExpression<bool> e1 = context.CompileGeneric<bool>(fixedformula);

   bool evalresult = e1.Evaluate();

I receive the error:

Cannot convert type 'String' to expression result of 'Boolean'

Do I need to define fixedformula differently? I'm sure there is a simple answer but I'm not homing right in on it.


Apr 12, 2011 at 6:04 PM

Problem solved.

When being passed to Flee via variable, Flee likes to see: LEFT(ehandle,1)="L" AND (LEFT(ihandle,1)="L" OR LEFT(ihandle,3)="NHI")