2 Replies Latest reply on May 15, 2015 10:31 AM by Dillik

    FM14 treats local variables as global variables

    user13640

      Summary

      FM14 treats local variables as global variables

      Product

      FileMaker Pro

      Version

      14

      Operating system version

      Windows Server 2012

      Description of the issue

      Local variables declared in a Let statement (and possibly also Set Variable step) are not flushed after the script is executed. They won't show up in the Data Viewer unless you manually add the local variable as a statement to evaluate. However, the variable's value is definitely evaluated by any subsequent scripts. As you might imagine, this is a critical bug, as often a local variable is only declared under defined conditions, and due to this bug, scripts now see values assigned to that local variable once declared in a prior run script.

      Steps to reproduce the problem

      Create a script that declares a local variable (may require declare by Let command). Run it. Open Data Viewer and add that variable for analysis.

      Expected result

      Local variable should be null after script is executed.

      Actual result

      You will see the local variable which should be null after script has run retain it's value.

      Configuration information

      Using 14 Advanced.

      Workaround

      Add script steps to set all local variables to null at beginning of each script.

        • 1. Re: FM14 treats local variables as global variables
          hschlossberg

          This would indeed be serious if replicable, but I'm unable to replicate.  In my test script, I added an If[] statement that tests for:

          Let( $test = 12345; 1 )

          I run the script.

          I open data viewer and watch/evaluate for $test, but the value is null.

          Please elaborate on what step your Let() statement is in and show us what that statement says.

          • 2. Re: FM14 treats local variables as global variables
            Dillik

            A few versions back (circa 12 maybe?) I encountered a similar situation where I found a local variable still hanging around after a script ended. Ever since then, I've tried to be meticulous about resetting local variables when a script is about to use them. I suppose that practice might also help avoid problems if you ever end up sandwiching two scripts together and their variable names overlap, but I mainly did it out of concern that I couldn't trust local variables to be 100% clean going in.