2 Replies Latest reply on Jul 12, 2009 5:56 PM by tl-designer

    Evaluate Formula Stored in Database

    tl-designer

      I'm trying to allow users to store formulas in a database field to allow them to create their own analysis page.

       

      I have set of variables that the user can use to create their formulas.

       

      The problem I'm coming across is that I can't get the database formula to evaluate.

       

      For example.

       

      I have the following variable that is already set.

           <cfset Cost = "12500">

       

      If my user decides to add a repair line to their analysis the formula could be saved in a database field name LineItemFormula and the formula would look something like this.

           Cost * 0.05

       

      Then when the repair line is diplayed I want to display and store the value:

           625

       

       

      I can't seem to get the database formula to evaluate.

       

      I tried #evaluate(de(LineItemFormula))# but that just displays

           12500 * 0.05

       

      So I tried evaluating this new string and I get

           String index out of range: 0 null

       

      If anyone can give me some advice on what I'm doing wrong or if what I'm trying isn't possible I would appreciate it.

       

      Thanks

      Torri