Re: Parsing and storing formulas
From: Sylvain Lafontaine ("Sylvain)
Date: 10/30/04
- Next message: John Wood: "Re: Pronouncing Enum"
- Previous message: Patrick Blackman: "Re: MS Office installed"
- In reply to: Stefan Rosi: "Parsing and storing formulas"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 30 Oct 2004 19:42:03 -0400
Is the number of users and the number of formulas by user very great or if
there are only a few users, with one formula for each?
In the second case, you could easily store different views/stored
procedures/user defined functions with the same name but different owner;
each user having his own set.
S. L.
"Stefan Rosi" <invalid@invalid.com> wrote in message
news:uc0TP5PvEHA.1300@TK2MSFTNGP14.phx.gbl...
>I was wondering how I can parse a mathematical formula in a storable way.
> For example I have two parameters like X and Y. And the user has to
> specify
> a formula to calculate the result. Like 2(Y+2X). Then this formula has
> to
> be stored for in the database. Each time the user visits a specific page,
> the calculations have to be done according to his own formula.
>
> Till now I have two ideas, the first one is to store the formula in just a
> string and make the variable names identical to their representation
> columns
> in the database. So I can just execute the query against the proper table
> and SQL Server will parse the string and return the result. Anyway this
> method has two drawbacks, first I can't use stored procedure anymore, and
> second the mathematical operations can be very complex, which will be a
> problem because sql server is not a mathematic program.
>
>
>
> The second idea is to represent the formula as a tree. Each inner node
> stands for an operation like multiplication, addition . etc. and the
> leaves
> are either variables or constants: to clarify this idea I will attach a
> diagram with this post. When I want to make the calculations I have just
> to
> cal a function on the root, and it will call the same function on it
> children and so on recursively. The tree will be serialized and saved as
> xml
> in the database.
>
> Anyway this tree will be hard to implement.
>
> So I just wanted to ask if somebody knows a better way to do this task. I
> am
> sure I am not the first person faced with this problem.
>
> How can I parse and store an entered formula? Is there any ready component
> to do it?
>
>
>
> Any answer will be appreciated.
>
> Stefan
>
>
>
- Next message: John Wood: "Re: Pronouncing Enum"
- Previous message: Patrick Blackman: "Re: MS Office installed"
- In reply to: Stefan Rosi: "Parsing and storing formulas"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|