1 Reply Latest reply on May 20, 2019 2:29 PM by Eslam_Elbyaly

    populate master ig column with sum(column) from detail ig when submitting the page



      Apex 18.2.

      I have a master-detail ig's.

      1- master(id pk, document_date,....., net_amount). Net_amount is a calculated field but it's stored into the database. I know that storing a calculated value could be arguable but I need it for performance purposes. It should be populated with sum(total) + discount. Total is a column in the detail ig. Discount is a column in the master ig which has the net_amount.


      2- detail ig(id pk, item_id, qty, price, total). Total= qty * price. And it's a calculated column too.


      - When the user submits the page I need to do the calculation of the net_amount again on the server to avoid manipulating with it's value. The calculation is already done on the client side.


      How to do that?