Unique ID generation

Can any one help me to resolve this issue:

When two users are creating documents simultaneously the document number is getting duplicated ie both the documents get same number. The format that I am using is: i increment the latest created document number by 1 and give the new document that value as its number. Please give me a good solution for overcoming this Issue

Thanking in advance

Ranjith

Subject: Unique ID generation

Assign the document number when they are saved, not when they are opened for composing. Use a Profile Document to store most recent document number. And keep the prodile document updated each time a unique number is created.

Regards

Litty Joseph

Subject: RE: Unique ID generation

That should be a normal document used as a profile document, NOT a real “Profile Document”, as they are cached locally and users won’t see each-others updates.

Subject: RE: Unique ID generation

But the best solution is to not use consecutive numbers at all for IDs. There is no way to make them 100% save, especially in a replicating environment.

Use e.g. @Unique (without a parameter) instead.

Subject: RE: Unique ID generation

Thanks for your advices…I am facing the problem while saving the document. It is during saving only the document id is created. I have tried for sequential number id than random numeric id i still face the problem of replication. The document is a normal document by itself. The ID generated is by appending letters from the username along with some numeric code generated on the basis of username using @soundex function. But 2 users with same name can cause the same issue at times. Please give me some way to sort this out

Regards

Ranjith

Subject: RE: Unique ID generation

Just use @Unique. Domino will handle user name collisions for you, and the user tag + timestamp will be unique on every call, regardless of replication.