3 Replies Latest reply on May 28, 2013 9:10 AM by philmodjunk

    Getting rid of variables in the data viewer while debugging

    LewisRobinson

      Title

      Getting rid of variables in the data viewer while debugging

      Post

           While debugging a script, the data viewer contains the variables I was looking at in an earlier script.  I see no way to get rid of them.  It says they are in the current script -- but they aren't.  How do I get rid of them?

           I think I figured it out -- the variables I can't get rid of are global variables in the other script.  Any way around this, as I plan to use a lot of globals

        • 1. Re: Getting rid of variables in the data viewer while debugging
          philmodjunk

               You are correct that all global variables that currently have a value set to them will appear in the data viewer.

               I would suggest that you not use global variables unless it is absolutely necessary to do so. They can be a challenge to keep track of and since the Data-Viewer is the one way that you can track global variables that currently exist, I wouldn't want them to not be visible in the viewer.

               That said, if you use a script to set the variable to a null value such as Set Variable [$$GlobalVariable ; Value: "" ], it should disappear off the data viewer's list.

          • 2. Re: Getting rid of variables in the data viewer while debugging
            LewisRobinson

                 Correct. There was no reason to use globals for what I want to do.   The lifetime of a script (which doesn't call others) is quite enough.  Thanks for the tip about null values.

            • 3. Re: Getting rid of variables in the data viewer while debugging
              philmodjunk

                   It may be interesting to note all the different ways you can temporarily store data not specific to any one record:

                   Global Fields-->Can be used for direct data entry by the user. Can be used as a match field in a relationship. Pay attention to how they work differently in networked versus stand alone environments.

                   $$Global Variables-->created the first time it is assigned a value and persists until the file in which it was created is closed

                   $Script Variables--> only persist as long as the script that created it is still running. You can get multiple copies of that variable--each with a different value should your script call itself recursively.

                   Calculation variables (no dollar sign)--created inside a let function and only persist within the confines of the let function's parenthesis. (But let functions can also assign values to global and script variables.)

                   Script Parameters--much like script variables, the value(s) in a script parameter persist as long as the script to which the parameter was passed is running and can be accessed with get ( ScriptParameter). But unlike a script variable it can allow you to pass data from a specific button click, script trigger trip, or perform script call and the value can even be passed to a different file if Perform Script is used to perform a script in a different file.

                   Script Results--Value is passed from sub script to calling script via Exit Script [Expression] and then the calling script can use Get ( ScriptResult ) to access the data--which remains accessible only so long as the calling script is still running. Haven't needed to test this, but presumably, exit script can pass data from one file back to the original file much like a script parameter passes data in the opposite direction.