AnsweredAssumed Answered

Unexpected result using Get ( ScriptResult ) function

Question asked by JeffHough_1 on Jul 7, 2010
Latest reply on Jul 27, 2010 by TSGal

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

Outcomes