4 Replies Latest reply on Aug 26, 2014 12:44 PM by Alok Dubey

    Formula item as a db item


      hi ,

      i have a db item , and i set the calculation property as a formula , and set a formula for it which calculates some values and throw the result in it ,

      the item as a db item , but it does not throw the result in the database , is this normal  or i can do anything to make it throw the result into the db column ?


      thank you

        • 1. Re: Formula item as a db item
          Zlatko Sirotic

          It is normal. See in Forms help:


          About recalculation of calculated items

          Form Builder automatically marks a calculated item for recalculation whenever the value of a bind variable involved in the calculation is modified in any way.

          Note that actual recalculation doesn't happen immediately. It occurs sometime after the item is marked but before the new value of the calculated item is referenced or displayed to the end user.

          Your application's logic should not depend on recalculation of a calculated item occurring at a specific time.

          Record Status:  Recalculation does not change the status of a calculated item's record, even if the status is NEW.


          And, the Formula (or Summary) item is automatically (implicitly) non-database item.




          1 person found this helpful
          • 2. Re: Formula item as a db item

            So , there is no solution ?

            i found one , which is creating another db item , and in the pre-insert trigger , assign the value of the formula item to it , and it worked .

            but i was asking if there is another solution ?

            1 person found this helpful
            • 3. Re: Formula item as a db item
              Zlatko Sirotic

              Your solution is quite good.


              Another solution, "database centric", would be eg. to use database triggers (AFTER UPDATE ... FOR EACH RECORD),

              in which we calculated the (derived) field, based on other fields from the database (if the other fields are from the database, of course).




              • 4. Re: Formula item as a db item
                Alok Dubey

                You can calculate the value in When-Validate-item trigger and assign it to non database item/database item.