cas305 Posted May 14, 2002 Posted May 14, 2002 I am looking for a way to get a Auto entered serial number to reset everyday? Any help would be great. I would like for it to go back to 01 at the first record everyday.
slstrother Posted May 14, 2002 Posted May 14, 2002 If you have version 5.5, you can do this with a opening script. You will need a global date field "gDate" and I called your serial number field "serial". Set this script to run when the file opens. You will also need to enter an initial date into the gDate field. The script as follows: File Open: If["gDate=Status(CurrentDate)"] Exit Script Else Set Field["gDate","Status(CurrentDate)"] Set Next Serial Value["Serial",""01""] End If
Vaughan Posted May 14, 2002 Posted May 14, 2002 It's the getting it to "reset every day" part that is going to be tricky. If it's a single-user database the task is easy, and a simple startup script as slstrother suggested is fine. If the database is multi-user then the task is going to be difficult. Because of the way global fields work (each guest's values are independent and don't necessarily update the main database value) the script will reset the serial number every time the database is opened by a guest. In this case a solution will be to replace the global field with a "preferences" file field. A prefs file is a database with only one record that is globally related to all records. Because it's a real field in a real record any changes are permanently remembered for all users immediately.
cas305 Posted May 16, 2002 Author Posted May 16, 2002 Yes Vaughan, it is a multiuser database and it is always running. I am still kinda confused on how it will know when the date has changed and that it will know when to reset the serial number value. If I set a "preference" file field will it take care of that problem? Any help on this would be great.
IdealData Posted May 16, 2002 Posted May 16, 2002 Can you get away with closing and re-opening the files on the host (for a few minutes) : If so you could, for FMP hosting, run Vaughans script on start up, or, for FMServer hosting, schedule a recalculate today which would also run Vaughans script when the files are opened locally.
IdealData Posted May 16, 2002 Posted May 16, 2002 How about... MAC Use iDoScript to schedule a DB open to reset the serial value at midnight. WINDOZE Use Task scheduler to do the same
cas305 Posted May 16, 2002 Author Posted May 16, 2002 I am running it on filemaker server 5. I am trying to get away from having to do anything on it daily. If I have to do anything daily on it then i might as well just reset the serial value to 01 everyday. This is kinda of a new area for me on FM so thanks for any help.
cas305 Posted May 16, 2002 Author Posted May 16, 2002 I have thought about trying to use a apple script and I just downloaded the I do scheduler on tuesday. Any ideas on how I would set up that script to reset the serial value??? I thought I had read somewhere that you can't get apple script to define field values. I don't care what method I have to go about to get this to work..... as long as it will work with out me having to manually work on it everyday. Thanks
IdealData Posted May 16, 2002 Posted May 16, 2002 Take the easy route... Write an AppleScript to fire up a FMP file. Set the startup script to perform the necessary action in FMP Close the FMP file Job done
cas305 Posted May 16, 2002 Author Posted May 16, 2002 Filemaker and scripting are not my strong point. Any help on how that startup script would go?:
IdealData Posted May 16, 2002 Posted May 16, 2002 If you're on FMServer then you also have the option to schedule a "Recalculate Today". This will close all open file in FMServer Then opens all those file in FMP (results in "Today" recalculation) This gives sopportunity to have a FMP file execute the necessary actions to modify the serial value (refer back to Vaughans post).
Vaughan Posted May 17, 2002 Posted May 17, 2002 This comes back to the issue of "keys with meaning" that LiveOak and Ocean West have mentioned in the past. The best keys have no meaning. Now I know why. Kill the idea completely. Live without them.
Recommended Posts
This topic is 8333 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