• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

Fields appear twice or sometimes even three times in a document

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).
0
Sjef Bosman
Asked:
Sjef Bosman
2 Solutions
 
Sjef BosmanGroupware ConsultantAuthor Commented:
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...
0
 
SysExpertCommented:
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 !
0
 
Bill-HansonCommented:
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.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
Sjef BosmanGroupware ConsultantAuthor Commented:
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).

Sjef
0
 
qwaleteeCommented:
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.
0
 
Sjef BosmanGroupware ConsultantAuthor Commented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now