Subject | RE: [firebird-support] How to implement sequential IDs with no missing vals? |
---|---|
Author | Alan McDonald |
Post date | 2005-03-17T21:14:52Z |
> We want sequential "admission numbers" in our app to be auto-generated forI use the method of educating users into not having a number to start with -
> the user (they need to see them, but getting the next sequential value
> automatically rather than relying on the data entry people to always
> accurately know what the next one should be).
>
> A generator won't work, I don't think, because we don't want any missing
> values. IOW, if the user starts a record, and gets number 123445 and then
> for some reason doesn't complete the record, that number will be
> unused and
> there will be a hole in the sequencing.
>
> If I could wait until just before the post to grab the number, that would
> probably solve it, but again, the user wants to see this number
> all through
> the data-entry process.
>
> Any ideas on the best way to implement something like this? The best thing
> I've been able to think of so far is to select max(admission_number) from
> the table and use the next number through the data-entry process,
> but query
> for that value again just before posting and, if it has changed, increment
> the number again and inform the user of the numbering change.
> There must be
> a better way, though.
>
> Clay Shannon,
> Dimension 4 Software
something they appear to tolerate anyway with your method of changing the
number at time of commit.
then you need to make sure that when you post an application, it's committed
for good. i.e. if you want to delete it later, you use a method of tagging
it deleted but never expunging it so the "voided" application is never lost
from view permanently - perhaps have a filter to not show voided app by
default.
Many accounting systems do not generate an invoice number immediately you
say you want to create one. It's only after you have finished the invoice
and want to commit it that an invoice number is created.
In the same way, if your users desparately want a number to begin with, then
they can start an emtpy applciation, commit it straight away then spend 2
weeks completing but it's at the time of commit that they create the number.
Mind you, behind the scenes I create my own number with an ordinary gen
value which has missing gaps etc, but they never see this number ever.
Alan