I have a requirement to execute very simple user defined
formulae. The user would create an object of a certain class, and
in certain cases the value of one of the properties would depend
upon another object of the same class that had been created
So assuming the objects have a property called "Price", I
would like to enable the user to create an object A with a Price of
30 and object B with a Price equal to the objectA.Price * 2.
I am guessing that the way to do this is to store a formula
as a string in the database
eg objectB.Price = objectA.Price * 2;
But how do I retrieve that formula and execute it?
Can I convert the string to become a function, if so can you
show me the code for that?
This is actually quite difficult in AS, since there is no
true eval() function, thus no way to execute a string tht looks
like an expression.
I think you are going to have to parse your strings yourself,
and execute the operations manually.
To support this in our app, the use must create the
expression, then publish the app. Publishing builds a string
defining an mxml component, using the strings they wrote. When the
published component is compiled and run, the epressions execute