Jump to content

restarting a serial sequence


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

Recommended Posts

I have a service call database. I need to assign a unique number for each call. The first part of the number is the date. The second part of the number is to be the number of calls taken that day up to that point.

So, the first call on January 4th 2001 will be #010104-001. The fifth call on that day will be #010104-005. The second call on January 5th 2001 will be #010105-002.

Any clues on how to generate that 001, 002, 003 sequence and then restarting the next day automatically.

Thanks.

Link to comment
Share on other sites

quote:

Originally posted by jpkrey:

I have a service call database. I need to assign a unique number for each call. The first part of the number is the date. The second part of the number is to be the number of calls taken that day up to that point.

So, the first call on January 4th 2001 will be #010104-001. The fifth call on that day will be #010104-005. The second call on January 5th 2001 will be #010105-002.

Any clues on how to generate that 001, 002, 003 sequence and then restarting the next day automatically.

First setup a date field and a sequence field.

Setup a relationship by today's date to the date field, sorted by the sequence number, in descending order (i.e. highest first).

Then when creating records, check this relationship. If it is not valid (i.e. this will be the first record of the day) assign your call number as date & "001". If the relationship is valid, then assign your call number as date & sequence number + 1.

------------------

=-=-=-=-=-=-=-=-=-=-=-=-=

Kurt Knippel

Consultant

Database Resources

mailto:[email protected]

http://www.database-resources.com

=-=-=-=-=-=-=-=-=-=-=-=-=

Link to comment
Share on other sites

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