Addam Posted January 21, 2002 Posted January 21, 2002 Ok... Here's the situation... I have a field that auto serial enters the number 1 and incriments by 1. Let's say I create 5 records. I now have a running tab that goes from 1 to 5. If I delete 5, and then create a new record, the field will continue and go to 6. Is it possible to have it go BACK to 5? If so, how do I tell it to do that? Can anyone help! Thanks!
tlsparker Posted January 21, 2002 Posted January 21, 2002 Rather than using Auto-Enter serial number, you could auto-enter a calculated value. For example, Status(CurrentRecordCount) would automatically set the field value to five if it is the fifth record regardless of how many times you have created and deleted a fifth record in your file. HOwever, if you create and delete records often, your calculation will need to check for uniqueness of the value if you are indeed using it as a serial number. We might have other ideas if you share more info about your intended use for this field. Hope this helps. Tom [email protected] http://www.tgparker.com/filemaker
Vaughan Posted January 21, 2002 Posted January 21, 2002 FMP 5.5 has a script step that allows the "next serial number" to be modified. You'll have to script the delete and new record steps and ensure the users don't use the built-in commands. Alternatively (and this is a method I like) don't let people delete records. Delete all the data, and then modify the "make new record" process so that it looks for blank records and uses the first availble, only makeing a new record if none exist. I like this method because it will fill-in gaps in the middle of the record series, not just the end. In a system where duplicate numbers are forbidden (like document management, cheque books etc) this system is unsuitable.
Addam Posted January 23, 2002 Author Posted January 23, 2002 Ok... Here's the BIG PICTURE! I have a 2 databases. 1 main and 1 secondary. Whenever a record is created in the main db (by script), one is created in the secondary. They are related by a constant incrementing number in BOTH datbases. I have it working to the point of if one is deleted in the main DB (by script) it will delete the corresponding record in the secondary one. The idea works GREAT in this situation because if the buttons (scripts) were always used, the dB's will never go out of sync. Problem: If I turn off the option to create or delete records in the main or the secondary dababase, the scripts will not work. SO... I'm trying to make this DUMMY Proof. I have it set up to where it WILL flag you if a mismatch has occured, where and what record(s). The idea is to have the two databases get themselves back in sync, without loosing any data. Currently I can get it to sync itself back up if a record is CREATED in the MAIN or Secondary DB's with a click of a button. That part was easy. BUT if one is DELETED in either one without using the script, I loose the sync, and I cant get it to replace the missing number in the string. Example: Main DB: 1,2,3,4,5,6 Secondary: 1,2,4,5,6 ** I need to find a way to replace that "3" in the secondary DB. ** Pourpose: The reason for doing all of this, is to allow my users to create layouts if needed. They won't be able to do it in the Main DB, but they can in the Secondary DB. That way they can't currupt any data or mess up my nifty looking layouts. I hope this helps! ~Addam~ [ January 23, 2002: Message edited by: Addam ] [ January 23, 2002: Message edited by: Addam ]
Vaughan Posted January 23, 2002 Posted January 23, 2002 If the numbers are the same, create a relationship with the option to delete related records. Now when somebody deletes record 3 in the master file, record 3 is deleted in the related file. No scripts needed.
Addam Posted January 24, 2002 Author Posted January 24, 2002 LOL!! That was the answer! Dang! It was right there infront of my face... Kinda like sayting "It doesn't work" and the answer is "Try pressing the button that says ON" lol Thanks! ~Addam~
Recommended Posts
This topic is 8446 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