I have a client that allows users to specify a particular format for records. Not the id, but as good as.
So the user can select a format of say
- yyyy-1st 3 chrs of client name-next available file number
or
- file manager initials, next file number, yy
or
- next file number, yyyy, file manager initials
they can also add more items so you might get
- next file number-yyyy-client initials-managers initials-yy
Having difficulty visualising the solution on this and how to store the format in a table, pull it out and generate the required number.
Especially given that the client can
- change format at any time
- the next file number needs to be the next one.
I guess the important piece i am missing here is to generate a query giving me the “next file number” if there are already records.
edit
not limited to sql. I just can’t think of a solution that will allow me to store a number in a custom format and then generate the next number based on that format.
What we require our users to do is to reformat the existing records when they change the format. When the format is changed, we know the old format and the new format, so we can update the existing records.
If the visual record number is integral to your operations and needs to be retained, I would then keep a shadow copy in the record that contains the record number formatted according to the current format. You can update this in all records when the format is changed and finding the next available number is now a simple select statement.