2 Replies Latest reply on Jul 27, 2010 12:03 PM by TSGal

    Unexpected result using Get ( ScriptResult ) function

    JeffHough_1

      Summary

      Unexpected result using Get ( ScriptResult ) function

      Product

      FileMaker Pro

      Version

      10/11

      Operating system version

      Mac OS X 10.6.4

      Description of the issue

      Assuming you have a script that call two other scripts ( A & B ). Script A exits with a result of 1. Then Script B is performed. Script B ends without an Exit Script step.

      When you reference the function Get ( ScriptResult ) after Script B, the value returned will be 1 (the result returned from Script A).

      Steps to reproduce the problem

      1) Open FMP
      2) Open ScriptMaker
      3) Make new script (Script A)
        a) Add the script step Exit Script ( Result ) = 1
      4) Save and close Script A.
      5) Make new script (Script B)
        a) Add the script step Comment (no value required)
      6) Save and close Script B.
      7) Make new script (Main)
        a) Add the script step Perform Script (Script A)
        b) Add the script step Show Custom Dialog
          1) In the body of the dialog, enter Get (ScriptResult)
          2) Close dialog edit.
        c) Add the script step Perform Script (Script B)
        d) Add the script step Show Custom Dialog
          1) In the body of the dialog, enter Get (ScriptResult)
          2) Close dialog edit.
      8) Save and close Main.
      9) Run Main

      Expected result

      First dialog should contain '1'
      Second dialog should contain ''

      Actual result

      First dialog should contain '1'
      Second dialog should contain '1'

      The FMP help description for the function Get (ScriptResult) reads:

      "Use this function as part of a calculation within a script. If a subscript doesn't return a result, then the content of the script result will be empty."

      I would take this to mean the function Get (ScriptResult) should only have scope until the next Perform Script step is initiated. It seems the scope extends until the Exit Script step is used again by a sub script or the main script exits.

      Workaround

      I have to include an Exit Script with a result for each sub script when using the function Get (ScriptResult).

      iChat_Image%282892251320%29.jpeg

        • 1. Re: Unexpected result using Get ( ScriptResult ) function
          TSGal

          Jeff Hough:

          Thank you for your post.

          I am able to replicate the problem on both Mac and Windows computers running FileMaker Pro 10 and 11.

          I have forwarded your post along with my findings to our Development and Software Quality Assurance (Testing) departments for review and confirmation.  When I receive an update, I will let you know.

          TSGal
          FileMaker, Inc.

          • 2. Re: Unexpected result using Get ( ScriptResult ) function
            TSGal

            Jeff Hough:

            Here is some information I received from Testing and Development...

            "The script result will live for the life of the script or until it is explicitly overwritten by another Exit Script call.  The second Exit Script from the subscript does not overwrite the return value so the value set from the first subscript persists.  The documentation for Get (ScriptResult) is inaccurate.  If the script result already has a value then the user needs to explicitly clear the value if they need it to be cleared."

            The information has been sent to the Manager of our product documentation to be updated in a future release.

            TSGal
            FileMaker, Inc.