Giving each new document a "sequential number"

I am currently developing a sales database where I would like to give each new document created a "sequential number." However, each document requires a reader field to limit viewing of the doc to other sales groups.

If I understand your problem correctly, you want to apply sequential numbers to each document, but that requires that you look the last document up to see its number so you can increment the new document's number by 1. Problem is, the reader names field may restrict you from seeing the last document, so you will not get the highest valid number.

One way around this is to write some code in a closing event of your form that manages a single document that keeps a record of the serialization of your documents. You can then just look to this document to figure out what the next number is. This offers some speed advantages but has a little pitfall in that it will be a little more exposed to document corruption and replication/save conflicts. An alternate method would be to create a "stub" document that tracks the serials for each document that you create. This document would have no readers field and might contain fields like (serial_no) and (parent_unique_id). I would include the parent_unique_id field just in case you run into problems later with missing documents. If you do, then you can write an agent to manage orphans and missing children easily.

Make sure that your closing code that creates this "stub" document immediately follows it up with a simple lookup that verifies the document was created successfully. If it was not, do not allow the save of the initial document. Hope this helps you.

Dig Deeper on Lotus Notes Domino Administration Tools

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 ...