crabuback Posted March 16, 2008 Posted March 16, 2008 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.
IdealData Posted March 16, 2008 Posted March 16, 2008 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?
mr_vodka Posted March 16, 2008 Posted March 16, 2008 How are you getting the name of the tab? Are you using GetLayoutAttribute ? More info is needed.
crabuback Posted March 16, 2008 Author Posted March 16, 2008 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.
mr_vodka Posted March 16, 2008 Posted March 16, 2008 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.
comment Posted March 17, 2008 Posted March 17, 2008 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.
crabuback Posted March 17, 2008 Author Posted March 17, 2008 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.
Recommended Posts
This topic is 6106 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 accountSign in
Already have an account? Sign in here.
Sign In Now