How Would I Do This? Document Version Handling

I have a Notes database that contains spec documents. Each document has a 4-digit main document number along with a separate suffix field #. There may be several versions of the same main document. (Example 1001-1, 1001-2, 1001-3, 1001-4 and etc…….).

I have received a request to allow a user in “any” level to click a button on that document and have the system generate another level document with all the information contained in the “highest” level document, (not necessarily pull info from the document they are in), with the level suffix set to one higher than the highest level. (Example – if the user is in document 1001-1, 1001-2, 1001-3 OR 1001-4 and clicks on a button, the system needs to make a copy of the 1001-4 document, (highest current version), and change the suffix of the new document to -5. When this document is saved there would then be a 1001-1, 1001-2, 1001-3, 1001-4 and 1001-5.

I can pull info from a parent document into a child document but don’t know how to make it pull from a document they may not even be in.

Subject: How Would I Do This? Document Version Handling

You’d need to have a view containing all documents created with this form. The first column should contain a concatenation of the main document number and the suffix (so they display as 1001-1, 1001-2, etc.) and be sorted in descending order (so the highest number is the first to display.)

When the user clicks the button in 1001-2, for example, you will need to do a NotesView.GetDocumentByKey, where the key is the main document number only (1001). GetDocumentByKey returns the first matching document, and since the view is sorted so that the highest suffix is displayed first, it should return the document for 1001-4. You can then get the value of the suffix field from that document and create your new document’s suffix field value by incrementing that value by one.

Subject: RE: How Would I Do This? Document Version Handling

Thanks Esther. That’s what I needed. Worked like a charm.