Jump to content

Restarting server 7


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

Recommended Posts

  • Newbies

Well, mainly because we are having a problem with a number increment script we wrote. Maybe I can explain the problem and someone will know the answer, which would eliminate the need to restart. Keeping in mind we are not professional script writers, and are doing what seems to work best through trial and error, here goes:

We have a field "Indiviidual ID": Type: Number, Indexed, strict, unique, display message if validation fails

Another field "Next Individual ID": Type: Number, Global

One can enter a number in the "Next Individual ID" field. The following script will increment the number and display it in "Individual ID".

The script:

Enter Browse Mode[]

Set Field ("Individual ID", "Next Individual ID + 1")

Set Field ("Next Individual ID", " Individual ID")

Set Field (" Individual ID", "U + Individual ID")

If you are wondering why we didn't just use "Auto-Enter Serial Number " for the field, this field only increments when the script on a button is run, we don't want it to increment every time a new record is created. Also, we need to be able to change the value in "Next Individual ID" easily because sometimes we delete an individual, but want to reuse the number. Having the field there eliminates the need to go into Define Fields to change the number, then change it back again.

We realize there may be a better, or more standard way to do this, so if anyone has any suggestions about incrementing the number, let us know.

Now, back to restarting the server. This script was working fine for us until we got Server. As soon as the files were on the server, the "Next Individual ID" box began to randomly reset the number to a former number after the script was run, or during the night. There does not seem to be any reason or rhyme to the number it picks, but once it picks it, the field is reset to this number each time. I tried to patch this problem by having the file run a script on opening which sorts the records by Individual number, gets the highest number and puts it in the "Next Individual ID" field. This seemed to work fine for a few weeks, but now the problem is back. The number is being reset to some random former number until we restart the server. We don't know enough about the inner workings of FM, FMServer to really understand what could be going wrong. If anyone has any ideas, we would be estatic to know. If we could fix this problem and avoid restarting the server every day, we would be so happy. Rememeber, please be kind, we are not pros, just employees trying to deal with an assignment we are not really qualified for...

Link to comment
Share on other sites

Froggy:

Welcome to the Forums. What you're encountering is due to the way globals are handled in the FileMaker Server environment. Under Server, globals are local to each individual client machine; when that client logs off, whatever globals it was using are trashed, and are replaced upon next login by the globals that were in use the last time the FileMaker files were edited locally (i.e., in the development phase).

Thus, for what you're trying to do, globals may not be the way to go. However, there's something odd in your script - why are you setting "Individual ID" twice? There is a bit of circular logic there which I don't follow. Especially your variable "U". What does it do?

-Stanley

Link to comment
Share on other sites

  • Newbies

yes, the circular logic. This is where the part about me not being a programming pro comes in.

Basically what we are trying to do is increment the largest "Individual ID" number (by adding 1 to the "Next Individual ID" field) and put a "U" in front of it. The reason for having the Next Individual field instead of just incrementing the Individual field is to be able to change the number being incremented to a previous one, so we can use up unused numbers(are you totally confused yet?)

To explain the "U", it is the letter we use to visually distinguish an Individual's ID number ("U" stands for "unique") versus the number which indicates the individual's family group, "C" for "Clutch". The numbers are rarely the same, but we have hundreds of family groups and hundreds of individuals, so it is nice to be able to see at a glance if the number is an individual or a group.

If you have any ideas for a better way to increment the number and put a "U" in front of it without the global field, I would really appreciate a suggestion.

Thanks so much for explaining the problem with the global field. It makes perfect sense now. I felt like I was going crazy for a while there!

Thanks again

Link to comment
Share on other sites

Off the top of my thinking cap, I would likely change IndividualID to type Text... and I suppose you would want the "U" to be a reference from a script or field depending on whether or not it changes based on the record type... then set the script like this:

Enter Browse Mode[]

Set Field ("Next Individual ID", "Next Individual ID + 1")

Set Field ("Individual ID", "LetterReference" & "Next Individual ID")

But you may have to set up a single record table with Next IndividualID as a field so that it will retain its value and reference it that way. AND you should trap for hits from multipleusers at the same moment or risk having duplicate numbers. I have been down that road before and it ain't fun to clean up later. OR

Simply rely on FileMaker to auto-enter a unique serial number and make a calc field to append the LetterReference to it. <if I understand the problem correctly>

Link to comment
Share on other sites

  • 4 weeks later...
  • Newbies

Hi,

sorry I have been so long in replying.

"But you may have to set up a single record table with Next IndividualID as a field so that it will retain its value and reference it that way. AND you should trap for hits from multipleusers at the same moment or risk having duplicate numbers. I have been down that road before and it ain't fun to clean up later"

This idea intrigues me. I am back here in FM 6, so let me see if I am understanding this correctly.

When you say a single record table, it is what used to be called a separate file. This file would have one record containing the "Next Individual ID" field. This would circumvent having to use a global field within the original file, since all the records in the original file could access the "Next Individual ID" field via a relationship. Am I on the right track?

I am not clear what kind of matich field I could use. I would need every record the original file to be able to find this one record in the new file. Could I just make a new field in the original file which has a set value, one which matches a field with a set value in the new file?

Am I making this more difficult than it needs to be!?!

Thanks for your help,

Link to comment
Share on other sites

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