The example isn't working

Mar 18, 2009 at 9:27 PM
Something is going bad with this sample!!!

I took your example from
// Create the calculation engine
CalculationEngine engine = new CalculationEngine();
ExpressionContext context = new ExpressionContext();
VariableCollection variables = context.Variables;
// Add some variables
variables.Add("x", 100);            
variables.Add("y", 200);
// Add an expression to the calculation engine as "a"
engine.Add("a", "x * 2", context);
// Add an expression to the engine as "b"
engine.Add("b", "y + 100", context);
// Add an expression at "c" that uses the results of "a" and "b"
engine.Add("c", "a + b", context);
// Get the value of "c"
int result = engine.GetResult<int>("c");
// Update a variable on the "a" expression            
variables["x"] = 200;
// Recalculate it
// Get the updated result
result = engine.GetResult<int>("c");

I am getting a "Ciloci.Flee.ExpressionCompileException: IdentifierElement: Could not find a field/property/variable with the name 'a'."... How can I solve that?
I am asking this cause I am implementing something really similar to this... this example is perfect to solve my problem!

Thanks in advance!

Mar 19, 2009 at 12:56 AM
Hmm....If I paste the code you posted into a project and run it using the library it works fine and doesn't throw an exception.

Perhaps you can post a sample project that reproduces the problem?
Apr 2, 2009 at 7:43 PM

thanks for your answer... maybe that was some problem with my version, I was using an old one... my project as really dirty as well... now, everything is working fine!