5 Replies Latest reply on Jun 29, 2012 9:00 AM by comment

    Looking at Variable Value

    Jason_Farnsworth

      Is the a way to see what a variable's value is while doing a field calculation?

       

      I am trying to debug a calculation and want to verify the contents of the variable.

       

      Thanks

       

      Jason

        • 1. Re: Looking at Variable Value
          karendweaver

          Hi Jason

           

          If you don't have it already - I strongly recommend you upgrade to FileMaker Pro Advanced and use the data viewer.  In addition you will get a Script Debugger.  Can't live without Advanced if you are doing serious development.

           

          If you've got it - open the data viewer and watch  your variables as you step through the script with the debugger.  Oops - just noticed this is a calc - same thing - you can enter calculations in the data viewer and even parts of calcs (such as the variable) and see what the results are.

           

          If that's not possible, one alternative is to  add a Show Dialog script step that displays the variable contents.  You could also add a merge variable to the layout and watch it there.

           

          But FMPA will save you hours and hours and hours of time and trouble.

           

          Karen

          • 2. Re: Looking at Variable Value
            erolst

            If you have Advanced, make the variable a global variable by prefixing it with $$. Now you can watch and track it in the Data Viewer.

             

            EDIT: I second Karen. If you don't have Advanced, get it.

            • 3. Re: Looking at Variable Value
              comment

              Jason_Farnsworth wrote:

               

              Is the a way to see what a variable's value is while doing a field calculation?

               

              An example would be useful, I think.

              • 4. Re: Looking at Variable Value
                Jason_Farnsworth

                Let ( [$1st  = Truncate (DiscriptionData1/12 ; 0) ;

                       $2nd = DiscriptionData1-($1st * 12) ;

                       $3rd = Truncate ($2nd/1 ; 0) ;

                       $4th = Fractions32 ($2nd - $3rd) ;

                       $5th = $3rd + 1 ] ;

                 

                I would like to see how the math is working

                 

                Thanks

                 

                Jason

                • 5. Re: Looking at Variable Value
                  comment

                  How about this way =

                   

                  Let ( [

                  step1 = Truncate ( DiscriptionData1 / 12 ; 0 ) ;

                  step2 = DiscriptionData1 - step1 * 12 ;

                  step3 = Truncate ( step2 / 1 ; 0 ) ;

                  step4 = Fractions32 ( step2 - step3 ) ;

                  step5 = step3 + 1

                  ] ;

                  List ( step1 ; step2 ; step3 ; step4 ; step5 )

                  )

                   

                  This will return a return-separated list of the calculation's progress.