Variable formula creation in vb.net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've got a requirement to create formulas for calculations. The problem is
that the formulas can be changed by the user. I plan on putting the formulas
on SQL Server and each varable/operator as a record. Then I can just replace
the variable with the number and calculate the result. That way the formula
can be changed by the client thru admin pages. Essentially I want to know if
I can put together an formula expression as a string and use this to
calculate my result?
 
BTW - example would be A + B = C
each variable or operator will be a record in SQL server.
 
Sure Chris. Remember that the expression is going to be a string. Figure out
the business rules for creating your formulas, and then write a function
that parses the string according to those rules, and executes the business
logic from it.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.
 
Chris said:
I've got a requirement to create formulas for calculations. The problem is
that the formulas can be changed by the user. I plan on putting the formulas
on SQL Server and each varable/operator as a record. Then I can just replace
the variable with the number and calculate the result. That way the formula
can be changed by the client thru admin pages. Essentially I want to know if
I can put together an formula expression as a string and use this to
calculate my result?

Have a look at <http://www.devx.com/vb2themax/Tip/19438> which is (I
think) a very neat way of using the power of the regular expression
engine to create a really straightforward and extensible expression
evaluator.
 
Back
Top