Jim
Fri Feb 03 22:25:29 CST 2006
You could use the JavaScript Eval function from DotNet storing the formulas
and token values in the database.
Here is a link that describes a few options.
http://www.codecomments.com/.NET_Scripting/message365093-1.html
My personal favorite is:
\\\Eval by Nigel Amstrong
1. Create a file called: DynamicMath.js
2. Add this code to it:
class DynamicMath
{
static function Eval(MathExpression : String) : double
{
return eval(MathExpression);
};
}
3. Compile it with the command line jsc compiler: jsc /t:library
DynamicMath.js
4. Add a reference to DynamicMath.dll to your project (and to
Microsoft.JScript.dll as well)
5. Use from your favourite .NET language:
Dim d As Double = DynamicMath.Eval("2 + 3 + 4")
MessageBox.Show(d)
6. That's it..
///
"JDF" <who@no.com> wrote in message
news:KeCdnUaTDszUzn7enZ2dnUVZ_tWdnZ2d@suscom.com...
> Does anyone have experience creating a formula generator and storing the
> formula in a database for re-use? I want to give my end user the ability
> to create custom formulas. The end user would create the formulas in a
> grid selecting fields and controls to use in the formulas. The problem I
> am having is coming up with a method of storing the formula and then using
> the formula in my app. Any help will be greatly appreciated.