Jump to content

Access Developer seeks FM advice - Script triggers


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

Recommended Posts

  • Newbies

Hi, I'm new to FM and this site so I hope I'm posting in the correct place. I've been using Access some years so I am having difficulty in understanding how to automate FM, as I keep thinking of the Access way. I wish to create a database for storing details of 35mm slides. Each record has a field that holds the page position that the slide is stored in, value 1-20. I wish to have this record auto update, the value being set to 1 more than the previous entry in the database. If the value is greater than 21 then reset to 1 and so on. The simple way to achieve this is to store the value of the previous record in the present record and use a calculated field to set the value. However, this is ugly as I'm using a field unnecessarily - there has to be a better way. I have a script that sets the value based on the previous record. My question is how do I trigger the script? In access there are many events that may start a script in FM I may create a button to add a new record and run my script which is fine until a user decides to bypass it and use a keyboard short cut (cmd+new).

Q1- Is there a better way of doing the above?

Q2- Is it possible to disable the FM menu and keyboard short cuts or intercept them as trigger events for scripts?

Thanks in advance

Simon

Link to comment
Share on other sites

You can create a number field (named keyP for primary key) and in the field definition options set it to auto-enter serial numbers. Then create a second number field (named frame) which is also set to auto-enter, but this one will auto-enter a "calculated value". Specify the calculation to be "Mod(keyP, 20) + 1". Each time a new record is created, the next frame will be 1 greater than the last, until it reaches 20, at which point it will start incrementing again at 1.

It should be noted that using this method, "gaps" can occur in your numbering sequence if somebody creates a record, deletes it, then adds another record.

Link to comment
Share on other sites

I think some more information would be helpful.

Why does this matter? It sounds you are trying to automate something that shouldn't even be part of the data record. Are you aware of the FileMaker record number symbol: @@?

For instance if you have used a muti-column layout to display the slides, and you want to print it, and you to be able to refer to slide 14 page 3, you don't need to do anything except put the record number symbol on the layout.

Link to comment
Share on other sites

  • Newbies

Thanks for the replies. However, I am still none the wiser! I'm not after a specific solution but rather a general way of designing FM databases. For instance if I have a script that the user may run via a button is there any way of triggering the script to run automatically when a new record is created. Also is it possible to disable the menu options on the main filemaker menu e.g. command new for new record?

Rod - I explored your idea but was unable to get the auto code to refer to the previous record, a solution is possible using an extra field on the record based on the previous record but this seems clumsy to me.

Link to comment
Share on other sites

Filemaker (unlike Access) is totally designed with the "user" in mind, not the developer. In order to prevent certain events from by-passing the developer added scripting (such as a user pressing cmd-n) then you need to disable those menu options.

This can be done in a VERY BROAD manner by defining security rights which are associated with specific Filemaker passwords, or by using a plug-in (such as SecureFM) which will allow a very granular assignment of privledges based upon scripting.

For example: in my solutions, I define 4 levels of access: none, user, manager and developer. The entire solution defaults to access level none by auto-entering the none-level password. I use a login file or launcher to allow a user to login and access a different security level with rules defined by the needs of the solution.

By controlling what a specific user is allowed to do you can force them to use your scripted navigation to perform the appropriate functions.

Does that help?

Link to comment
Share on other sites

This topic is 6543 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
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.