4 Replies Latest reply on Aug 27, 2012 7:36 AM by beverly

    Hold script

    dila

      how to hold calculation to run until user key in all the field required their's input?

        • 1. Re: Hold script
          comment

          You could change your calculation's formula to something like =

           

          Case (

          not ( IsEmpty ( InputFieldA ) or IsEmpty ( InputFieldB ) or IsEmpty ( InputFieldC ) ) ;

          <your formula>

          )

           

          ---

          Note: calculation is one thing, script another.

          • 2. Re: Hold script
            ariley

            The calculation will evaluate every time there's a change in the record or when you load the layout, etc.

             

            You can't really hold a calculation. You can however give it conditions, just like Michael said to evaluate only if certain conditions met.

             

            Just wanted to shed a little light.

             

            agnes b. riley . filemaker and web development

            www.zerobluetech.com

            T 201-299-6223 (NJ) . 212-842-8830 (NY) . 917-660-7221 (C)

            FileMaker Certified in 10 and 11

            • 3. Re: Hold script
              BruceHerbach

              Hi,

               

              One apprach to this would be to use a script to set the value of the field.  On the data entry fields add a OnModify or OnValidate script trigger.  The script would put the value of the field in to a global variable ($$Variablename).  When the script runs it checks to see if all of the global variable values are filled in.  Use isempty($$Variablename) to check.  If they are then it sets the value of the Field.

               

              When all of the Globa variables are populated do the following:

                Use the values to calculate the value for the field and SetField()

                Clear all of the Global variables.  So that you are ready for the next record or the next round of changes.

               

              An addition to this... you can have the Script pop up a dialog box telling the user what fields still need to be populated.

               

              HTH

              Bruce

              • 4. Re: Hold script
                beverly

                +1 on what Michael and Agnes said.

                I sometimes use this when I want to temporarily disable a calc. It could use a global field and apply to any calculation field as needed.

                 

                     calc with constant boolean number:

                If ( 0 ; << my real calc goes here >> ; "" ) // change the "0" to "1" to make the calc "trigger"

                 

                     calc using global field:

                If ( globals_TO::calcTrigger_gn = 1 ; << my real calc goes here >> ; "" ) // change the GLOBAL number field from "0" to "1" to make the calc "trigger"

                 

                YMMV (your mileage may vary),

                Beverly

                p.s. I wonder if other countries use YKMV <- your kilometers may vary.

                 

                The calculation will evaluate every time there's a change in the record or when you load the layout, etc.

                You can't really hold a calculation. You can however give it conditions, just like Michael said to evaluate only if certain conditions met.

                Just wanted to shed a little light.

                agnes b. riley . filemaker and web development