8 Replies Latest reply on Mar 27, 2017 6:45 AM by steveoh

    Display Global Variables





      I'm attempting to create a debug button (for iPad usage mostly) that will allow me to have global variables in a pop up menu.

      For example, this is what I am doing now (which works):

      Screen Shot 2017-03-23 at 1.37.03 PM.png


      My Question:

      I'm trying to make a way to see any given global variable while running my scripts as a somewhat backdoor approach to the non existant iPad data viewer.  Is there a way to view all current variables?  Something like {{GlobalVariables}}?

        • 1. Re: Display Global Variables

          No such item exists and you can't put them in a menu. I put them in a popover and hide the button unless a global variable's value indicates that I've put the system in "debug mode".

          • 2. Re: Display Global Variables

            That is essentially what I have done with my solution..  I have essentially got a 'debug mode' function that allows me to test certain things without all of the applicable conditions or checks.  Perhaps that would be a nice future function.  Do you know of an alternative way to debug iPad scripts on Filemaker Go?

            • 3. Re: Display Global Variables

              The other thing that I've done is set up a global text field for logging values, etc during script execution. I then modify the script that I'm debugging, adding steps that append data to this field.


              The code for this "trace" might look like this:


              If [$$Debug]

                  Set Field [Globals::gDebug ; List ( Globals::debug ; "FieldA:" & Table::FieldA ; "$Variable:" & $Variable ) ]

              End If


              You can include script/Layout names in this field as well--pretty much anything that might provide a useful clue on why the script isn't working.

              • 4. Re: Display Global Variables

                I like that, it's rather similar to what I have been doing, but it could work to make it better.  Thanks for the suggestion

                • 5. Re: Display Global Variables

                  Just don't forget to disable it when you no longer need it. This trick cured some major design headaches a while back, but then I took a look at the file and found that this one global field had a truly massive amount of text piled up in it--increasing the size of the file by a sizeable fraction as I'd forgotten to stop the logging.

                  • 6. Re: Display Global Variables

                    When I have trouble with a script, I'll put in a series of Show Custom Dialog Step.  In the dialog I'll show variables, errors and field values that are relevant to the script. This will allow me to step through the script.   I like Phils idea of activating a debugging mode. 

                    • 7. Re: Display Global Variables

                      I ended up using a calculation field and had it formatted into something resembling a table.  The field is visible in a popup when debug mode is enabled (global variable I was already using) so that was never an issue. 


                      I was initially going to make a text dump field as you suggested, but as I don't hardly use calculation fields thanks to scripts, I figured it wasn't too bad.

                      • 8. Re: Display Global Variables

                        Yeah that's about all I was able to do too lol.