Jump to content

Recommended Posts

hutchlad    0

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

Share this post


Link to post
Share on other sites
Lee Smith    147

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

Share this post


Link to post
Share on other sites
comment    1,381
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. 

Share this post


Link to post
Share on other sites
Wim Decorte    455

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

Share this post


Link to post
Share on other sites
comment    1,381
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.

 

Share this post


Link to post
Share on other sites
Wim Decorte    455
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

Share this post


Link to post
Share on other sites
comment    1,381
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.

Share this post


Link to post
Share on other sites
Fitch    148

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

Share this post


Link to post
Share on other sites

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


  • Similar Content

    • By NewBoard
      I have a database, which has two printable forms. One has been designed in portrait, and the other in landscape. Both of them are only ever printed using buttons tied to script steps, never manually. I was hoping that there would be some way to specify orientation via the script. However, after some poking around of my own and light Google searching I am thinking this may not be so easy.

      I am able to go into Print setup to change the orientation just fine, however this sets it for the entire database which is not all around helpful. While specifying the options in the print step, I am able to change orientation. For some reason though, this changes the default orientation across the entire database. Not even while running the script, but just specifying it in the options of the script step. So now I'm at a loss.
      If this is not able to be done, redesigning one of the forms wouldn't be that difficult. But if there's a way to do what I'm trying to do, any assistance would be greatly appreciated!
    • By wedgeman
      Use Case:  I've got a graphic (in this instance, a complete human body).
      I want to mouse-over and click on say, the hand, and have that trigger a script, with a parameter.
      I'd hope to simply have a single script, read the parameter (which would in fact grab the value of the tooltip), and have that passed into the script.
      It seems to me that the various flavors of "get(objectname), etc don't seem to have a way to grab the actual text that's in the "tooltip" or "object name".
      Am I missing something in there?
      I'd love to be able to create 50 graphics, name each one by tooltip (or object name), and not have to create/modify a script for each and every single graphic.
      thanks for any help!
       
      EDIT:  as a temp work-around, I've manually dropped the objectname into the script parameter, then have the script punch that into appropriate fields.. It's annoying to set up, and takes 5x's as long, but that's currently the only method I've got for this. 
      Any further options?
    • By Quito
      Hi,
      I want to create a Dropdown List of numeric options to select a range of records.  For example, the Dropdown list would contain:
      5
      10
      20
      50
      100
      -------
      edit...
      Each option would select the next 5;10;20;50 or 100 records to the right.  A Checkbox would be populated (with an X) in the selected number of contiguous records; Then, a Find Selected Checkboxes would return the selected records.  The contiguous selection should be independent of whatever the current state of Found (Sorted/Unsorted) is.
      Any help will be gratefully acknowledged.
      Best,
      Daniel
       
    • By wojeezy08
      My end goal is to have a button that, when clicked:
      1. Opens a pdf form from my server
      2. Fills in the form using data entered into FileMaker (I'm using FileMaker 10)
       
      I'm on step one and and trying to use the "Open File" script, however it's not working.  Can the "Open File" script be used to open non-Filemaker files, such as PDFs?
       
       
    • By jbante
      FileMaker 16 introduced a collection of built-in functions for manipulating data serialized as JSON. This makes it easier for FileMaker applications to interact with many web services. This will also make JSON the de facto standard format for scripts within FileMaker to pass parameters and results to each other, improving code sharing within the FileMaker community.
      JSON does not have a broad palette of scalar data types to choose from: text, number, boolean, and null. Even with those, FileMaker's JSONGetElement function always returns a text result, even when the serialized JSON value is a number or boolean. So I made a handful of custom functions and scripts for sending and receiving typed data with JSON.
      The module is hosted on GitHub, or you can download it directly.
×

Important Information

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