Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2662 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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

Posted
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. 

Posted

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.

  • Like 2
Posted
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.

 

Posted
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.

 

  • Like 1
Posted
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.

Posted

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

This topic is 2662 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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