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

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

Recommended Posts

Posted

Hi all,

Is there any way of knowing the current stacking order of the currently active scripts. Specifically, I'd like to know which scripts are running when a script lands on a layout or record and a layout trigger is fired. There are times when I want the triggered scripts to exit immediately if they are called by certain scripts.

Thanks in advance!

-Kent

Posted

There is no function to retrieve the current stack. Which is ironic, because it displays the call stack at the bottom of the script debugger with FMPro Advanced.

I've put in a request a while back to FMInc to have this function call. Hopefully we'll see this someday.

I've been able to mimic this functionality, but it was more of a pain than it was worth to implement in a large system. It's basically setting a global field at the beginning of each script with the script's name. Once it exits the script, it will remove that name from the field's contents. That means you have to account for every script call and exit - not a fun or reliable job.

Posted

There isn't a native way to know what the script stacking order is (though that info is available to FMP as visible in the Data Viewer). You could "roll your own" by setting a global variable $$ScriptStack to List ( Get ( ScriptName ) ; $$ScriptStack ) as the opening step in a script and removing it at the end of the script.

But I'm not sure you need to know what the whole script stack is to accomplish what you want.

You could, for example, pass the script name of the parent script as a parameter when calling the child and check that.

If I'm guessing correctly, you don't want triggered scripts to fire when a script is running. You can set a global variable ( I use $$triggersOff ) and check for that at the beginning of the triggered scripts, then clear it at the end of the parent script.

Posted

Thanks to both!

I already composed a routine similar to what Brent suggested and I think I'll have to go with that. I like David's approach for its simplicity but I need more than On or Off choices, as some subscripts sometimes need to run under a triggered, parent script, depending on the script that made the layout/record change in the first place. It would be nice to see a function that gets script stacks in the next version since the info is already available in FMPA via the script debugger, as Brent pointed out.

Cheers!

-Kent

This topic is 4805 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.