Most databases are developed to use a built-in feature used to autoincrement
an integer number that is stored in a column and used to uniquely identify
each record added to the database. That column is usually made to function
as a Primary Key (PK) to ensure each record is unique. Basically, the PK is
how the 'relational' aspects of a relational database interact with one
another.
When using the database to autoincrement in this manner the PK value will be
1,2,3 and so on. When initially created, the autoincremented number can be
seeded to start at some predetermined number such as 10 and made to
increment in two's, fives,or tens and so on. Most I assume simply start at 1
and increment by 1 each time a new record is added but starting at 1000 is
not unreasonable either.
IMO the easiest and most reliable method for a work order number is similar
to the invoice numbering schemas I've devised for e-commerce customers. The
methodology would reuse the PK value as doing so also provides an audit
trail. Using code, the value of the PK can be returned after each work order
is created as each work order is unique and will therefor have its own
unique PK value. You can accept the returned PK value as is or use the PK
value as a base value which is then appended and prefixed or postfixed with
other identifying characteristics which are usually delineated alphanumeric
series of characters.
For example; 2F-00035 where the PK value autoincremented by the database is
35 indicating the 35th work order created. Code would then append the
alphanumeric prefix 2F indicating the work order was for the 2nd Floor.
Script would append three zeros to the PK value resulting in '00035'
providing a series of 99,999 work orders for this schema.
Identifier schemas have to be carefully thought out however as it is easy to
schema one's self into a corner. When you hear web developers talk about
'scalability' this is the type of context they are referring to. Suffice it
to say, what I understand at this point in time indicates the need for
custom coding.
What database are you using? Tell us more about the rest of the work order
process.
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL
http://metromilwaukee.com/
URL
http://clintongallagher.metromilwaukee.com/
"Gene McKinney YMCA international"