Link to home
Start Free TrialLog in
Avatar of kev1609
kev1609

asked on

Auto Numbering

Hi

Wonder if anyone could offer some help - I've just designed my first database and now I wish to add autonumber to one of the fields, but I'm unsure of how to do this
ASKER CERTIFIED SOLUTION
Avatar of AndrewJayPollack
AndrewJayPollack

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of snocross
snocross

Andrew is right.  The problem with a numbering system is if there are several users operating remotely then they could have 3 separate numbers that could become the same and no way of incrementing one single master number.  We have a system where we have users creating db's on a notes server and also creating documents on a webserver so we increment an ODD number on the notes server and an EVEN number on the webserver to eliminate having duplicate numbers.  We do not allow the db to be copied locally so we don't have the issue of having multiple remote users creating duplicate numbers.

-Snocross
Sno, that works fine as long as it isn't a busy server!  
Drew what do you mean?  You mean the reading/writing of the profile number somewhere?  It doesn't seem to be a performance issue for us, we just have a profile database with profile numbers and then the profile does a lookup to the appropriate number record, locks the record, increments the record by 2 (because we do the odd-even thing), saves the record, then unlocks the record.

-Snocross
I mean if you allow concurrent web agents (which you generally should) then this can happen concurrently on a busy server.
Hello Kev1609,
Create a computed field, compute after validation, add this formula to the value field in programmer pane.
@If(@IsNewDoc;@Subset(@DbColumn( "" : "NoCache" ; "" : "" ; "(unique#lkup)" ; 1 );1)+1;unique#)
unique# being whatever you want the field called.
unique#lkup is a view created that keeps the numbers.
Create a view sorted decending that contains 1 column that contains the unique#.
This will get you started....
:)