3 Replies Latest reply on Aug 21, 2007 12:26 PM by ntsiii

    User Defined Formulae

    SlowPossiblyStupid
      Hi All,

      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 earlier.

      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?

      Any suggestions gratefully received.