Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hi Guys, Just a quick question for a beginner, I have created multiple export scripts, and notice that when I create a master script with the numerous subscripts being called, sometimes the output isnt correct, whereas when I run each script one by one (rather than lots of subscripts within a master script) the final result is fine. Could there be anything wrong with using subscripts for this?

Should I always have an Exit Script step at the end of each subscript? I hope that makes sense

Thankyou

Hi hutchlad,

Since you have FileMaker Pro Advance, why not use the Script Debugger and Data Viewer to see where the "Master Script" is breaking?

You could also copy the script and put into a reply here, or post a copy of the file, see Anatomy of a Good Topic on how this can be done. It also has addition tips on how to post in the Forum.

HTH

Lee

3 hours ago, hutchlad said:

Should I always have an Exit Script step at the end of each subscript?

No. You need an Exit Script step only when the subscript must return a result that the calling script will use further on. 

I'll counter that.  One of our standards is to always an explicit "Exit Script" and to explicitly pass an empty string "" when no real value needs to be passed out of the script.

The main reason is that the Get(ScriptResult) will remember the last explicit returned result.  If you don't use Exit Script in the sub script but expect Get(ScriptResult) to be empty because you didn't pass anything back then you may be surprised to see a value if a previous script did use Exist Script with a return.

7 minutes ago, Wim Decorte said:

The main reason is that the Get(ScriptResult) will remember the last explicit returned result.  

Indeed it will. So, if you call subscript A that returns result A, and then call subscript B that is not supposed to return anything, your method will erase the existing result A and prevent the main script from using it further on.

I am guessing that your standards also dictate that the result be copied to a variable to prevent that. But that's just unnecessarily complicating things.

 

14 minutes ago, Wim Decorte said:

If you don't use Exit Script in the sub script but expect Get(ScriptResult) to be empty ...

... then the problem is with your expectations, not with your practices. I realize you may be dealing with a bunch of junior developers, trying to prevent them from making a mess - but that doesn't make it a good practice for everyone.

 

4 minutes ago, comment said:

 that doesn't make it a good practice for everyone.

 

Didn't say that it was, just how we do it and why.

Doesn't matter where the "problem" comes from; our practice makes it safe no matter what someone's expectation is.  For any level of developer, one of ours or one of the in-house devs.  It's clear and well-understood.

 

2 minutes ago, Wim Decorte said:

It's clear and well-understood.

Like so many times before, we shall remain divided.

Still, even by your standards my original answer stands: you do not need an Exit Script[] step, unless you want to overwrite the script result register. All you're saying is that you'll always want to do that.

Why is a master script necessary? All planes don't need to fly through Heathrow.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.