Jump to content

Creating Record IDs within a range


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

Recommended Posts

I would like to create a number field that would have a number range from 0000 to 9999. The highest number would be 9999 after reaching it, the field would go back to 0000.

I also want to have a script that would allow me to increase and decrease the number on that field by 1, taking into consideration that if the field has the number 0000 and I use the script to decrease that number it would have to go to 9999.

thanks in advance. cool.gif

Link to comment
Share on other sites

Create a global number field called gNumber. Create a script that:

finds all records

sorts (ascending) by your record ID field

goes to the last record

sets the record ID of the last record into the gNumber field

creates a new record

sets the record ID field of the newly created record using the following calculation:

Case(

gNumber<9999,gNumber+1,0000)

Link to comment
Share on other sites

One thing I would recommend, though, is to create a number field that is an auto-enter serial # (your users never need to know it's there). Do you forsee any problems with records in your database having duplicate record ID? At least with an auto-entered serial #, you'll be able to sort out any messes that will result from having duplicate record IDs.

Link to comment
Share on other sites

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