2 Replies Latest reply on Sep 18, 2013 6:03 AM by thirdsun

    Refresh data in a related table


      I´ve developed an order system, using the tipical "invoice model" : Orders - Lines - Customers - Products. That works really well, the only -but- is that I capture the "Lines" using a Portal inside the "Orders" table and the calculated values in the "Order " table like : Total, Tax etc doesnt refresh during the capture of the items in the portal, I have to click ouside of the portal to get the Fields in the Order table refreshed, and that behavior is not really "nice", and even after clicking outside the portal, when changing the values of the already captured items in the portal, the TOTALS refreshes as expected, BUT new items does no refresh either, does I need to turn on some "hidden preference" ?

        • 1. Re: Refresh data in a related table

          As far as I know, the records in a portal are only committed when leaving the portal.

          I guess, there are quite a few ways to tackle this.


          You might use a list view showing the line items of the order where the details of the order and some summary fields are shown in the header and/or footer.

          In a list view the commits occur when leaving the record (as opposed to the portal as a whole).


          Another idea might be to use trigger scripts either on certain fields of the portal entries or on the portal as a whole. These trigger scripts might force a commit. However, the user will lose the focus on the field where he/she has just been. You would probably have to take care of that, too.


          I'm sure there are more ideas out there, that I just can't think of right now.

          • 2. Re: Refresh data in a related table

            Add a script trigger to each field that is relevant to the calculations. The script should be triggered when leaving the field (or even on keypress if the script is able to finish without lag) and should follow these steps:


            1. save current portal row in variable

            2. save current field name in variable

            3. commit changes

            4. go to portal row (in case there are several portals on the layout, name it and go to object before)

            5. got to field


            This is just from the top of my head, so some steps might be unnecessary or missing.