Replication Save Conflicts and StampAll

Hi,

we expanded a standard teamroom template a little bit - e.g. we added a status field.

An agent (see the following code) sets in all

thread related documents LastThreadStatusTX (parent, response) etc. with stampall.

This agent runs every 30 minutes, the forms have

merge / no conflicts and we use about four replicas on different servers. The agent runs always on the same server.

Unfortunately I get a lot of save conflicts and I don’t know why?

Any ideas are very welcome.

thanx in advance

ingo beyer

Sub Initialize

'/ PROTOTYPE!!! 

'/ Überarbeitung erforderlich - quick and dirty improvement :-) 

'/ ibr, 7. März 2005



On Error Goto Catch



Dim dbThis As Notesdatabase

Dim docParent As NotesDocument

Dim entry As NotesviewEntry

Dim entryColl As NotesViewEntryCollection

Dim session As New NotesSession

Dim strAuthor As String

Dim strModified As String

Dim strProcessstatus As String

Dim strThreadID As String

Dim strEntryAuthor As String

Dim strEntryModified As String

Dim strEntryProcessstatus As String

Dim strEntryThreadID As String

Dim strKey As String

Dim strEntryKey As String

Dim vwMainDocs As NotesView

Dim vwThreadIDByDate As Notesview

Dim varAuthors As Variant



Set dbThis = Session.CurrentDatabase

'/ Alle Diskussions- und Fehlerdokumente nach 'flach' Datum 

Set vwThreadIDByDate = dbThis.getView("vwThreadIDByDate")



'/ Ansicht mit allen Hauptdokumenten

Set vwMainDocs = dbThis.getView("vwMaindocumentsbyProcessStatus")

Stop

Set docParent =  vwMainDocs.getFirstDocument

While Not docParent Is Nothing

	strModified = Cstr(docParent.Created)

	strAuthor = docParent.From(0) 

	strThreadID = docParent.ThreadID(0) 

	strProcessstatus= docParent.ProcessstatusTX(0)

	strKey = strModified & "-" & strThreadID  & "-" & strProcessstatus & "-" & strAuthor

	Set entryColl =  vwThreadIDByDate.GetAllEntriesByKey(strThreadID, True)

	Set entry = entryColl.GetFirstEntry

	'/ View anpassen wäre performanter. So mehr Kontrolle

	strEntryModified = Cstr(entry.Document.Created)

	strEntryAuthor = entry.Document.From(0)

	strEntryThreadID = entry.Document.ThreadID(0)

	strEntryProcessStatus =entry.Document.ProcessstatusTX(0)

	strEntryKey = strEntryModified & "-" & strEntryThreadID  & "-" & strEntryProcessstatus & "-" & strEntryAuthor

	If (strKey <> strEntryKey) Or (entry.Document.LastThreadStatusTX(0) ="")Then

		Call entryColl.StampAll("LastThreadStatusTX", strEntryProcessStatus)

		Call entryColl.StampAll("LastAuthorNA",strEntryAuthor)

		Call entryColl.StampAll("LastModifiedDT",strEntryModified)

	End If

	Set docParent =  vwMainDocs.getNextDocument(docParent)

Wend

Finally:

Exit Sub

Catch:

Print Error " in Zeile " & Cstr(Erl)

Resume Finally

End Sub