Jarvis Posted June 25, 2009 Posted June 25, 2009 Is there a way to set a number field to always be equal to the value of the same field from the previous record..... plus an increment of 1? What I have in mind is something that produces a similar result to an auto-enter serial number. What I want to be able to do is delete a record in the middle of a list and have the number value for the next record adjust itself automatically to be equal to the new "previous" record. I hope this makes sense. Any ideas?
Lee Smith Posted June 25, 2009 Posted June 25, 2009 (edited) Take a look at the Auto Enter Options available for the Fields. In the Define Fields, Click on the Field to be serilized, click on Options, Auto Enter, Serial Number. Lee Edited June 25, 2009 by Guest
Josh Ormond Posted June 25, 2009 Posted June 25, 2009 (edited) Is there a way to set a number field to always be equal to the value of the same field from the previous record..... plus an increment of 1? What I have in mind is something that produces a similar result to an auto-enter serial number. What I want to be able to do is delete a record in the middle of a list and have the number value for the next record adjust itself automatically to be equal to the new "previous" record. I hope this makes sense. Any ideas? Why do you want to do this? I suppose there are some reasons for it, but most of the time it is unnecessary. In a relational setup, changing ID numbers (especially if you are using them as the match field in the relationship) opens you up to a host of problems both now and as you get more data in the solution. For your ID fields, I would stick to the normal Auto-enter serial numbers that Lee mentioned. If you really need a field consecutively numbered, you can look at the Get(RecordNumber). But keep in mind that it is very dependent on the context of the found set. Changing the found set, and sort order I believe, will affect the number if gives you. Otherwise you could look at creating a list of numbers that you update as you create and delete records, to keep track of what is used and what is not. Kind of a transactional model of sorts. Edited June 25, 2009 by Guest
Lee Smith Posted June 25, 2009 Posted June 25, 2009 Hi jmormond, Good catch, and I totally agree with you. Lee
David Jondreau Posted June 25, 2009 Posted June 25, 2009 It's unclear what you're trying to accomplish, but an unstored calculation field = Get(RecordNumber) may be what you want.
Jarvis Posted June 25, 2009 Author Posted June 25, 2009 Thanks guys for your help. FWIW: I include a serial number field on almost every database I write. As Lee suggested, I do this with an auto-enter, serial number option. For this particular application I am trying to serialize tasks for building processes in my cabinet shop. Usually the task list is developed proactively. In this case the auto enter serial number option works fine. Often times, however, someone will add a task on an adhoc basis. This task will either be something that we forgot or something we refined. In this case we still want the tasks to array sequentially (task 1 thru 10) but can't get there with just the serial number.
Vaughan Posted June 26, 2009 Posted June 26, 2009 Use the Replace command to re-serialise the records after they have been changed.
Recommended Posts
This topic is 5688 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