[Last Call] Learn how to a build a cloud-first strategyRegister Now


Fields appear twice or sometimes even three times in a document

Posted on 2007-10-10
Medium Priority
Last Modified: 2013-12-18
Hi all,

I've just been asked to investigate a very interesting problem. There is this server (Domino 6.5.3 FP1), and there are two databases involved. A document is created in the first one (based on a modified mail template), manually, and then a new document is created in the second database.

Sub Postsave(Source As Notesuidocument)
      Dim cdb As notesDatabase
      Dim doc As notesDocument
      Set doc=source.document
      Set cdb=doc.ParentDatabase
      Dim BaseBT As notesDatabase
      Dim dp As NotesDocument
      Set dp=cdb.GetProfileDocument("CalendarProfile")
      Set baseBT=New notesDatabase(getRDVSrv(dp),getRDVDb(dp))
      Call doc.ReplaceItemValue("BaseOriginal",cdb.FilePath )      
      Call doc.ReplaceItemValue("ServerOriginal",cdb.server )      
      Call doc.ReplaceItemValue ("AuthorOriginal",cdb.parent.userName)
      Call doc.ReplaceItemValue ("Consultant",dp.getItemValue("user")(0))
      Dim docR As notesDocument
      Set docR=baseBT.CreateDocument ()
      Call doc.CopyAllItems (docR)
      Call docR.ReplaceItemValue("Form","RDVC")
      Call docR.ReplaceItemValue("DocOrigine",Source.Document.universalId)
      Call docR.Save(True,False)
      Call doc.ReplaceItemValue("DocOrigine",DocR.universalId)      
      Call doc.save(True,False)
      Call CreerEntretien(doc)
      If (source.InPreviewPane) Then Exit Sub
      Call csEventObj.PostSave()      
End Sub

For some very odd reason, most fields appear twic in the second document, sometimes even more. Only Form and DocOrigin appear only once (!) in the document. The field $Revisions contains these dates: 01/10/2007 09:35:15 CET, 01/10/2007 09:35:17 CET, and 01/10/2007 09:35:41 CET.

The only thing that comes to my mind is that 6.5.3 FP1 contains a bug, in CopyAllItems, but there's no record of it anywhere.

Can you help me?? Is this a bug, does someone have an explanation, or how can I prevent it (document locking??)?

Additional info: Domino cluster, the document is created using the Notes client but there are multiple simultaneous web-agents running (2 at the moment).
Question by:Sjef Bosman
LVL 46

Author Comment

by:Sjef Bosman
ID: 20048979
Eh, in fact there are two sets of servers involved: database 1 on a cluster and database 2 on a different cluster. Wich may make things even more complicated...
LVL 63

Expert Comment

ID: 20049599
Isn't it time to upgrade to at least R 6.55 or R 6.56 ( R 7.02 would be even better ).

I know that this is not the kind of answer that you are looking for, but these kinds of problems are exactly the kind that get fixed with newer versions.

Especially with clustering.

I hope this helps !
LVL 22

Assisted Solution

Bill-Hanson earned 300 total points
ID: 20049736
I always specify the optional second parameter when I use CopyAllItems.

Call notesDocument.CopyAllItems( notesDocument [, replace ] )

If you don't explicitly set the "replace" parameter to False, then duplicate items will be created for existing items with the same name.

I wouldn't think that would be a problem for a new document, but it's the only thing I see in your code that is documented to create duplicate items.

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

LVL 46

Author Comment

by:Sjef Bosman
ID: 20052151
Thanks gentlemen! I'll look into both options tomorrrow, although I think that option 1 can be ruled out immediately (international bank, planned roll-outs, etc).

LVL 31

Accepted Solution

qwaletee earned 450 total points
ID: 20052708
As a test, try this bit of code:

Msgbox join(doc.BaseOriginal,";"),,ubound(doc.BaseOriginal)
Call doc.CopyAllItems (docR)
Msgbox "copied to docR " & join(docR.BaseOriginal,";"),,ubound(docR.BaseOriginal)
      Call docR.ReplaceItemValue("Form","RDVC")
      Call docR.ReplaceItemValue("DocOrigine",Source.Document.universalId)
Msgbox "saving docR " & join(docR.BaseOriginal,";"),,ubound(docR.BaseOriginal)
      Call docR.Save(True,False)
Msgbox "done " & join(docR.BaseOriginal,";"),,ubound(docR.BaseOriginal)

This way you can see when your code fires, and see the original value of one of the fields right before it gets copied, right after it get copied, right before the copy is saved, and right after. If you see it firing unexpectedly, you know that it is firing more than once... properly a nested event issue.  And you can compare the immediate results to what you ultimately find in the UI.
LVL 46

Author Comment

by:Sjef Bosman
ID: 20198973
Time to get back to you. I'm still not quite sure what caused this effect, but the problem seems to have subsided. Actually, I'm not quite sure it was even this piece of code. I noticed that the document was saved twice in the same agent, the calls were about 10 lines apart. The first save was required to obtain the document's UNID, in order to cross-reference the two documents. I moved some lines further down the code, and the problem has disappeared.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

829 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