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.

Global Variable not being passed

Featured Replies

I have created ten tabs with names such as Bldg, Veh, Supp for an inventory db that I have developed. When the tab is selected, I use a script to set a global variable to the tab name. This variable is then used in a Find routine to sort and find all records associated with that name.

For seven of the tabs everything works fine. For the other three, they fail to pass the variable (the variable is blank). The short script which sets the global variable and calls the find routine were all duplicated from the same script. Most of them work but three don't.

Any ideas on how to troubleshoot this? I'm very new to FM.

It looks like:

Set Variable [$$Variable; Value:"Bldg"]

Perform Script ["Find"]

In my Find Script, to look at the variable, I set a dialog as such:

Show Custom Dialog ["I'm here"; "Variable is " $$Variable]

Is there a better way? I only have FM, not FM Advanced.

You could run a single script provided your uses a script parameter, then the first line of your script could read

Set Variable [$$variable; Value:Get (ScriptParameter)]

where your script parameter is "Bldg", "Veh" etc..

The second point to note about variables is they do not pass between databases. Do you have multiple files in your solution?

How are you getting the name of the tab? Are you using GetLayoutAttribute ? More info is needed.

  • Author

No, I wasn't using GetLayoutAttribute.

I was using an individual Script for each tab that looked like (for the first tab which was named Bldg):)

Set Variable [$$Variable; Value:"Bldg"]

Perform Script ["Find"]

Seemed pretty simplistic to me. But like I said 7 of the scripts would pass their variable to Find Script and 3 will not.

I'll look into the other suggestions made.

This still does not help. If I am guessing here, you have 10 tabs with 10 different buttons that call 10 different scripts?

Why dont you zip and post your file. I am more than sure there is an easier way to go about this.

Most likely, the variable's name is misspelled in those 3 scripts. Or perhaps you are using a different repetition.

In any case, I too think you may be over-complicating this: you should define each button with a unique script parameter, and have them all trigger one and the same script.

I am not sure what tab controls have to do with this, since you cannot run a script by selecting a tab.

  • Author

Thanks to all that commented. I did get everything working using Script Parameters as first suggested by IdealData. Thanks for the tip. Also thanks for the tip from Mr_Vodka regarding the White Paper. Though I have just begun reading it, I've already learned a lot.

For others' benefit, I guess that I did not explain myself clearly. I've only been using FM for a few weeks, and I'm still grasping some of the terms. Yes, what I did have was a button on each of the ten tabs. I did check spelling and made sure that each variable was really a global. And yes, everything was in the same. Don't know what I was doing wrong, but Script Parameters is a far easier way to go.

I am truly amazed at how much I've been able to accomplish in such a short time. I had tried Bento on a trial basis at the same time I tried Filemaker. While it is even easier to use than Filemaker, it, of course, doesn't have near the power. I'm glad I purchased Filemaker.

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.