Auto Numbering

Posted on 2003-03-04
Medium Priority
Last Modified: 2013-12-18

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
Question by:kev1609
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Accepted Solution

AndrewJayPollack earned 80 total points
ID: 8065059
Notes is meant to be used in disconnected, replicated envrionments.  A squential numbering system can be built, but presents serious problems.  If you simply want a unique tag on the field, and it doesn't need to be sequential, make the field computed, and use @Unique() for the formula.  This will produce a multi-digit alphanumeric value that will be unique across all replicas or copies of the database.  

Big picture: Notes database design is more than just thinking through how to do things you do in other tools, you have to learn to think like notes.  This is one example where your application could have scale or rollout problems down the road if you just used a sequential number.

Expert Comment

ID: 8065161
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.


Expert Comment

ID: 8065233
Sno, that works fine as long as it isn't a busy server!  
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 8065334
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.


Expert Comment

ID: 8065363
I mean if you allow concurrent web agents (which you generally should) then this can happen concurrently on a busy server.

Expert Comment

ID: 8065620
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....

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question