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.

Detecting which Open file to run a script in via a Calculation

Featured Replies

Here's what I am trying to do.

Working with the separation model I have two different files ("Interface_1" and "Interface_2") that both work with another file "Data".

In both Interface files I have the same Field that I need to have trigger a script when the value in it is changed and I'm doing that with the help of the zippScript plugin.

Typically (written in the Data file) I have the change in the Field triggered by an Auto Entered Calculation that replaces the existing value written like:

[color:blue]Field & zippScript_PerformScript( "Interface_1" ; "The Script" ; "")

...and that works just fine,... for the Interface_1 file. But it ignores the Interface_2 file needing the same functionality.

But since either Interface file or even both of them could be open at the same time how do I write the calculation so that it triggers the script in the active interface file where the change was made.

I thought I could do this with the Case function written like this:

[color:blue]Case (

FilterValues( DatabaseNames;"Interface_1") = "Interface_1"; Field & zippScript_PerformScript( "Interface_1" ; "The Script" ; "");

FilterValues( DatabaseNames;"Interface_2") = "Interface_2"; Field & zippScript_PerformScript( "Interface_2" ; "The Script" ; "");

"It didn't work")

...and I just get the default answer "It didn't work" which tells me I am not detecting the open database files with my FilterValues( DatabaseNames: text) function.

  • Author

I figured it out,... I think,... or at least so far it's working.

I realized the FilterValues( DatabaseNames: text) function was what was screwing me up so I rewrote it like this:

[color:blue]Case (

IsEmpty ( FilterValues( DatabaseNames;"Interface_1") ≠ 1) ; Field & zippScript_PerformScript( "Interface_1" ; "The Script" ; "");

IsEmpty ( FilterValues( DatabaseNames;"Interface_2") ) ≠ 1; Field & zippScript_PerformScript( "Interface_2" ; "The Script" ; "");

"It didn't work")

Anyone see any problems I might not be aware of or see yet?

Can't see anything wrong with the original approach - especially as that's how it is exactly described in the FM help system.

I do notice an extra SPACE in the filename in the FilterValues test.

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.