Problem solve Get help with specific problems with your technologies, process and projects.

Adding field to give unique ID to documents

I'm building a form that will allow users to create and submit bug fixes or enhancement requests to the system I administer. I want to add a computed field that will automatically assign a unique ID for each new document that is created, with a set number of digits. For example, the first document will be Job Request #0001 (if I expect less than 1000 requests in my lifetime). What formula should I use for this field?
Use @Unique. I frequently see requirements that call for a sequential ID number for documents when in fact all that's needed is a unique identifier (if that). Numbers that are truly sequential are necessary only for transaction tracking, where it's important to be able to see whether there's a gap in the sequence -- for instance, in balancing your checkbook.

I know sequential numbering is appealing for its orderliness. But it's not as simple as just writing a formula, and you have to make some compromises in your application to make it work. Consider what happens when Ted creates a request, and still hasn't saved it when Julia composes her request. You would need a way of flagging a number as already assigned so that Julia doesn't get the same one. What if Ted is working in a local replica with no Internet access to communicate to the server that he's using up a number, or a different server replica where it takes time for the fact that he's used a number to replicate to Julia's server? What if Ted and Julia are both using the same server, and they both compose a request at nearly the same moment, so that between the time Ted calculates which number is his and he marks that number used, Julia grabs that same number? What if Ted changes his mind and doesn't save his request, and Julia does save hers -- is it okay to have a gap in the numbering sequence?

Go to http://www.lotus.com/ldd and in the Forum FAQs you will find extensive information on ways to uniquely identify documents . . .including numbering them sequentially if you decide that's really necessary.

Do you have comments on this Ask the Expert question and response? Let us know.

Dig Deeper on Lotus Notes Domino Application Development

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...