5 Replies Latest reply on Mar 11, 2012 7:18 PM by smclennan

    Calculation fields not updating - Newbie question

    smclennan

      I have calculation fields that are keys (two keys for one table) to a related table whose data is used by other calculation fields in the parent table. When the key fields are updated the other calculations are not refreshed with the new related data, unless I happen to go into Manage Database and even pretend to make a change, save the database, return to the layout. Then the updated data is there.

      What am I missing? When do calculations get refreshed? PS. They are all "unstored" calculation fields.

        • 1. Re: Calculation fields not updating - Newbie question
          comment

          I think you are saying you have one relationship depending on the results of another?

           

          If so, you may need to use:

           

          Refresh Window [ Flush cached join results ]

           

          to get the dependent relationship update its related set.

          1 of 1 people found this helpful
          • 2. Re: Calculation fields not updating - Newbie question
            smclennan

            Thanks for your help. I'm one step closer.

            I put a script trigger on the data entry field that is input to the calculation for one key (OnObjectExit) and now the calculations are refreshed, for that key change!

            The other key is not a data entry key. It is a count of some related records which I add to or subtract from by adding records in a portal. I'm not sure how to incorporate a Refresh in that case.

            • 3. Re: Calculation fields not updating - Newbie question
              comment

              I am afraid I don't follow your description. Why don't you post a file (preferably a simple one) that demonstartes the problem?

              • 4. Re: Calculation fields not updating - Newbie question
                keywords

                Depending on the context, sometimes a field which is calculating from a portal relationship will update when you click inside the field itself. Perhaps you could incorporate in your script a Go to field(your count field) then Go to field() (ie. leave the field again) to force the refresh.

                • 5. Re: Calculation fields not updating - Newbie question
                  smclennan

                  Sorry for the confusion.

                  Your Refresh Window suggestion has worked. I put a script trigger to Refresh OnObjectExit on one of the key fields. I put the same script trigger in a portal on the related record's key field which also works when a related record is added. In both cases, the calculation fields recalculate automatically.

                   

                  I still have a problem when portal rows are deleted. My calculations depend on a count of related records and therefore should recalculate when a portal row is deleted. This still isn't happening. I have a "delete record" button at the end of each portal row to which I added a Refresh Window command, but it doesn't seem to make a difference.

                   

                  I've added a stand alone Recalculate (Refresh Window) button which works, but I'd rather it was built in.