Dynamic parameters with array syntax

Topics: General
Sep 26, 2011 at 8:46 AM

Hello

Thank you for this great library.

I was wondering if it is possible to use dynamic parameters with array syntax

For example I would like to do something like this 

 Expression e = new Expression("5*(Field[0]+5/Field[1])");  

where Field[0] and Field[1] could be calculated dynamically in the EvaluateParameter event.

Also would be very interested if I could also use dynamic array parameters as in 

 Expression e = new Expression("5*(Field[Date]+5/Field[Date-1])");

where Field[Date] and Field[Date-1] could be calculated dynamically.

Best Regards

Neil

Coordinator
Sep 26, 2011 at 5:26 PM

I don't think so, but you might give a try with Jint, which seems to be more suited for this kind of stuff.

Sep 27, 2011 at 8:06 AM

Thanks for the reply.

While not as nice I think I can also use a custom IndexValue() function to achieve this with NCalc as in 

Expression e = new Expression("5*(IndexValue(Field,0)+5/IndexValue(Field,1))");

Neil