6 Replies Latest reply on Jan 28, 2015 4:55 AM by MorkAfur

    Forcing Calculation Refresh?

    MorkAfur

      Title

      Forcing Calculation Refresh?

      Post

      I have a simple situation: a customer table and a job table.

      I want to get the total $ of all the job $ entries in the job table. Therefore, I created an "x" relationship between customer and job.

      Then, created a field with a calculation:

      Sum(Job::JOB_EST_AMOUNT)

      So far so good...

      But, what happens is that after coming back to the main customer tab (in this case), this calculated field does not update with the new amount from the job just added. Screen Refresh doesn't work regardless of which of, or all, the checkboxes I pick.

      If I manually click on the SUM field on the customer tab, THEN it updates.

      I saw a thread from Phil back in 2012 so I'm hoping by now (three years later) there's a real way now to force a calculation to refresh.

      I tried adding the screen refresh on the panelswitch event and the object load event, but nope. It's not until I either navigate away from the parent record for whom I added the job or deliberately click on the SUM field.

      Strange...

      Thanks in advance for suggestions.

      - m

        • 1. Re: Forcing Calculation Refresh?
          philmodjunk

          Is this an unstored calculation field or a number field with an auto-entered calculaiton?

          Are you using FileMaker 13?

          Please describe the design of your layouts and whether you are doing all of this in one window or two. What exactly are you doing when you "come back to the main customer tab"?

          • 2. Re: Forcing Calculation Refresh?
            MorkAfur

            Hey Phil,

            Turns out I needed a Commit Records Script step. That fixed it.

            I'd never used this script step in five years of FMP so I guess I'll read up when it's needed....

            Thanks as always for your reply.

            - m

            I had a Customer Tab and a Jobs tab (the portal) with an "X" relationship on them so I could do a calculate regardless of the relationship. Could have used ExecuteSQL too I suppose to a variable to get the count and sum of the amounts in the portal, but didn't do it that way this time.

            In any case, I added to the OnPanelSwitch of my tab control the CommitRecords Request script step and the Customer tab is up to date when I click back to it.

            • 3. Re: Forcing Calculation Refresh?
              philmodjunk

              When I get a "won't refresh" issue, I run the following list of fixes from top to bottom:

              Commit Records
              Refresh Object (New in FMP 13)
              Refresh Window
              Refresh Window [Flush Cached Join Results]

              If I have to use the last option, I start re-evaluating my design as that option can lead to major delays waiting for a layout to refresh if there's a large amount of data involved.

              • 4. Re: Forcing Calculation Refresh?
                MorkAfur

                Amazing. You should write a "tips and tricks" book for FMP.

                This is great information!

                (as always)

                Most of the current FMP books are, IMHO, way too basic ("your first script", etc.).

                Thanks Phil!!!

                - m

                • 5. Re: Forcing Calculation Refresh?
                  philmodjunk

                  Well I have launched a kind of small scale series of, for lack of a better description, FileMaker Files pretending to be e-zines on FileMaker techniques:

                  They are free to download, but I do provide info on how to make a "donation" if you care to support future releases of the series.

                  Adventures in FileMaking #1 - Conditional Value Lists (includes details on how to set up a basic field based value list)
                  Adventures in FileMaking #2 - Enhanced Value Selection (what to do when a simple value list won't cut it.)

                  #3, Many to many relationships is currently "in development".

                  Caulkins Consulting, Home of Adventures In FileMaking

                  • 6. Re: Forcing Calculation Refresh?
                    MorkAfur

                    Why not instead, or in addition to, setup a web site on your domain and make a big deal out of your skill and knowledge?

                    You could also blog, etc..

                    Just an idea.

                    - m