Jump to content
Server Maintenance This Week. ×

Global Variable not being passed


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

Recommended Posts

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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