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

Calculating stacking order of scripts on the fly

Featured Replies

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

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.

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.

  • Author

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

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.