4 Replies Latest reply on Feb 10, 2015 1:38 PM by DavidJondreau

    Custom functions do not load - why?

    dburnham

      I have a database that uses a dozen or more custom functions.  All of them are defined to be available to all accounts.

      There is an un-stored calculation field in the database that uses an equation such as this:     cost + fee +  CustomFunction.

      My customer and I are both using FileMaker Advanced 13.  He doesn't know about custom functions and the only reason I mention that he uses FileMaker Advanced 13 is because that's to dismiss the notion that different FileMaker versions are the cause of what we are experiencing.

       

      When I look at the un-stored calculation field, I see the result of  cost + fee + CustomFunction.

      When he looks a the same record on the same layout he sees the result of only cost + fee.    Custom Function is being ignored.

       

      To troubleshoot this, I launched FileMaker 12 (not Advanced) and went to the suspect record on the suspect layout and indeed, I was viewing exactly what my customer viewed.  The incorrect result was ignoring the value that should have been given by the custom function.  In other words, the custom function did not load.

       

      Then, I created a new field called "test" and defined it to be the result of only the Custom Function and specified it to be un-stored.   I then placed that new field on the same layout and the correct result suddenly appeared in both fields.  The new test field displayed the value of the custom function and the suspect field also displayed its correct sum of cost + fee + Custom Function.  I don't know what triggered the correct recalculation of the field that uses the custom function.  Was it that I defined a new field that called the custom function, or was it that I placed it on the layout thereby forcing the result?

       

      More important, what's the best way to avoid this?  Create test fields that display the result of all custom functions and place them in the margin area of the layout?  Add some script steps to a script trigger that runs "on record load" ?

        • 1. Re: Custom functions do not load - why?
          DavidJondreau

          This isn't expected behavior.

           

          So, either one of two things are happening. Either you're missing something or you have some weird corrupted file. Have you tested different combinations of logins and machines? Are you referencing functions not available in 13? Does it occur on all records or just some? Is the value truly different or could it be a display issue? There's a lot of possibilities.

          • 2. Re: Custom functions do not load - why?
            dburnham

            Thanks David.

             

            Weird corrupted file?  Perhaps.

             

            Yes, I have tried different logins and different machines.  There are no functions that are not available in 13.  The custom functions were actually written years ago in 10 or 11.   It occurs on any record that has not been "tricked" into seeing the result o the custom function.  I can't figure out what is kicking it into proper behavior.  For example, I went into layout mode, double clicked the field to view its definition.  Made no changes.  Clicked OK to close the Manage Database window and then in browse mode, the correct result was visible.

             

            I tried using Set Field to restore the identical calculation that is stored, but of course, Set Field can't work with a calculation field.

             

            One thing I have not yet tried is opening the field on the layout to access in Browse mode so that the user can view the full decimal precision of the displayed result and maybe that will wake up the Custom Function

            • 3. Re: Custom functions do not load - why?
              StanMillar

              Hi dburnham

               

              From your description, it sounds to me like the calculation is not being

              evaluated while you are in browse mode for that record when data are

              entered. Particularly since you say it updates when you go from Browse mode

              to Layout mode (to add the "new" field to the layout) and back again.

              Normally making the calculation unstored takes care of this but since you

              say the calculation is unstored, we need to take a wider look.

               

              A couple of things to try:

              Have you tried going to a different record and coming back to the one you

              started from? Does this give the correct result?

               

              Have you tried going to a different layout (staying in Browse made) and

              coming back to the one you started from? Does this give the correct result?

               

              If so, you need to refresh the screen to force the calculation to update.

              There are a number of ways to do this. Going to a different record or

              layout, then returning to your staring layout and record, or going to

              Layout mode and returning to Browse made are three of these. If there is a

              script running when data are entered, it is a simple matter to add a commit

              record step to achieve this.

               

              If not:

              Is the result correct on ANY of the records or is it wrong everywhere? If

              it's wrong everywhere something else is wrong with the formula. Does the

              custom function itself refer to another custom function that is not on the

              user's computer?

               

              Have you tried this in a bare bones fresh file with just a couple of fields

              ( cost, fee and calculated field =  cost + fee + Custom Function) on your

              client's computer (after defining the Custom Function in this file, of

              course)?

               

              Stan Millar

              Managing Director

              Bromac Business Services Pty Ltd

              Loan Administration

              w: www.bromac.com.au

              e: loans@bromac.com.au

              P: +61 7 3208 9411

              F: +61 7 3910 1092

              Secretary

              TFP Cooperative Limited

              w: www.tfp.coop

               

              This message contains confidential information and is intended only for the

              individual named. If you are not the named addressee you should not

              disseminate, distribute or copy this e-mail. Please notify the sender

              immediately by e-mail if you have received this e-mail by mistake and

              delete this e-mail from your system. E-mail transmission cannot be

              guaranteed to be secure or error-free as information could be intercepted,

              corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.

              The sender therefore does not accept liability for any errors or omissions

              in the contents of this message, which arise as a result of e-mail

              transmission. If verification is required please request a hard-copy

              version.

               

              *Please consider the environment before printing this email - every year we

              are losing 40 million acres of oxygen producing forests through logging and

              land clearing.*

              • 4. Re: Custom functions do not load - why?
                DavidJondreau

                It would be best to provide an example file, or at least a copy of your custom function. I suspect the issue would be clear after a few minutes of fresh eyes poking around.