Improve documentation of "Exit Script" command

Idea created by serval on Jul 14, 2016
    Active
    Score3
    • Benjamin Fehr
    • disabled_user24894
    • flybynight

    In the Script Reference manual, improve the documentation of the

    Exit Script [Result: <value or formula>]

    command. It should also say that the calling script uses the command

    Get(ScriptResult)

    to get that result.

     

    The use of "Exit Script" is well explained in the forums by wimdecorte at

    https://community.filemaker.com/thread/84177

    He says,

     

    There is a behavior in FM that the Exit Script result may persist across sub scripts.

     

    Say that you have a script "calling script"

    it runs script A and that one exits with result "a"

    it then calls script B and that one does not exit with anything

    after script B runs you check Get(ScriptResult) and you get "a".  That may not be what you intended because B ended without a script result and empty/null/nothing is what expected.

     

    So to overcome that you should explicitly take control over your script results.  Which can only be done through the "Exit Script" script step.

     

    Note that you have to make it exit with an explicit result to overcome this behavior.  So you could use

     

    Exit Script [ $null ]

    or

    Exit Script [ "" ]

     

    but not

    Exit Script []