Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I'm creating a databse with a main menu page. I created a button linked to a script I made. Funny thing is when this button is clicked, it doesn't work right. Whereas, from the same menu window, if I click on the script name from scriptmaker menu, it's fine.

I checked the specify button dialog, and the button is correctly linked to the right script.

Posted

Hi NCE,

There are only four differences between firing a script from Specify Button or from Script Maker (that I am aware of) ...

1) You have turned off (through Field Behavior) access to the field. If you specify Go To Field[] for instance (from Specify Button), it will not work if field access has been turned off. It will only work if specified through Script Maker.

2) An attached script parameter can only be specified from Specify Button. So the button click may be picking up a parameter but when executing from ScriptMaker, it can not.

3) A script fires depending upon the current layout at the time it is executed. And you may be firing each instance of script from a different layout table occurrence.

4) You have a script-step which requires the field be on the layout (such as Insert Calculated Result[]) and, in one instance, you are on such a layout and in the other instance you are not.

It is also possible to have two scripts attached to the same grouped set if they were grouped after different scripts were attached. A bit to the left and one script fires - a bit to the right and the other script fires.

If above four items aren't the culprit, drag around that button and keep hitting Arrange > Ungroup until the option isn't available any more. As you ungroup, FM will ask you if you wish to disconnect the scripts as well. Once the button is again 'clean,' reattach your script. wink.gif

LaRetta

Posted

Hi LaRetta,

Your last suggestion " ... ungroup until... " is the one I run into the most. It is usually a "No Fill", "No Line" graphic that is part of the button that turns out to be culprit.

HTH

Lee

Posted

In prior versions I would tend to agree, Lee.

But #2 and #3 are unique to vs. 7 and you'll see more of these kinds of misfire questions. Proper layout (table occurrence) and improper script parameter passing were what caused me the most problems when new to 7 (and can still catch me off guard). I remember spending hours trying to figure why a script with a parameter wouldn't work when tested from Script Maker but worked fine from the button - or a new record script working fine from a button on a layout and same script attached to another layout not creating the same new record. crazy.gif

Simply recreating the button would be the quickest test for sure. But because we weren't told even the concept of the script in question (to narrow it down), it's all speculation. Even GTRR can appear not to respond, if no related records found (whose ID could be based upon script parameter).

I hope I covered all possibilities to check so we don't have to play guessing games and waste NCE's (or our) time. I think it's the Butler in the Library with the candlestick myself. wink.gif

Posted

Hey, LaRetta. Seems like #3 is the culprit. Am doing some tweaking now and hope all will be ok.

However, seems kind of odd to me that a script should be fired from a specific TO. I figured with the correct script steps, it should work independent of the particular TO you are on. From a newbie's perspective, isn't this something that can be improved on FM7?

Thanks very much, people. This forum is a gem for newbies like me.

Posted

Scripts can be triggered from anywhere you like. The results of some script actions, however, depend on where you are at the time - for example, Delete Record/Request. So it's best to put a Go to Layout script step somewhere at the beginning.

Posted

thanks, comment. i'm just reading up on scripts and it does seem that there are instances that a script would require being in the right context when it is performed.

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