Home > Domino Tips > Administrator > Database > Analyzing save/replication conflicts
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

DATABASE

Analyzing save/replication conflicts


Bob Bryson
06.26.2002
Rating: -2.30- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Get an email report of the differences between two documents.

Put the following code into a manually triggered agent to run on selected documents, then select the parent and conflict documents and run the agent. It will email you with a list of differences - Common fields with different values and fields that exist on only one document or the other.

Warning: This agent may not work as expected with Rich Text fields or if the documents have multiple fields with the same name.

Code

'Purpose: To analyze Save Replication conflicts and send
 'an email report to the user
 
 Dim session As New notessession
 Dim db As notesdatabase
 Dim coll As notesdocumentcollection
 Dim parent As notesdocument
 Dim child As notesdocument
 Dim report As notesdocument
 Dim parentitem As notesitem
 Dim childitem As notesitem
 Dim rtitem As notesrichtextitem
 Dim itemname As String
 Dim richStyle As NotesRichTextStyle
 
 'setting values
 Set db = session.currentdatabase
 Set coll = db.unprocesseddocuments
 Set parent = coll.getfirstdocument
 Set child = coll.getnextdocument(parent)
 Set report = db.createdocument
 Set rtitem = New NotesRichTextItem ( report, "Body" )
 Set richStyle = session.CreateRichTextStyle
 
 'making sure that the user has selected two documents
 If coll.count<>2 Then
  Msgbox "Please select the two documents in question and try again."
  Exit Sub
 End If
 
 'setting the first heading
 Call rtitem.appendtext("Disclaimer: Please note this report tests the first occurrance of each item by name")
 Call rtitem.addnewline(1)
 Call rtitem.appendtext("If the documents have multiple items with the same itemname, this report may be inaccurate.")
 Call rtitem.addnewline(3)
 richStyle.Underline = True
 richStyle.Bold = True
 Call rtitem.AppendStyle(richStyle)
 Call rtitem.appendtext("Items on both documents that are in conflict")
 richStyle.Underline = False
 richStyle.Bold = False
 Call rtitem.AppendStyle(richStyle)
 Call rtitem.addnewline(2)
 
 'first check - All the common items
 Forall i In parent.items
  itemname = i.name
  Set parentitem = parent.getfirstitem(itemname)
  If child.HasItem( itemname) Then
   Set childitem = child.getfirstitem(itemname)
   If childitem.text<>parentitem.text Then
    richStyle.Bold = True
    Call rtitem.AppendStyle(richStyle)
    Call rtitem.appendtext(itemname)
    richStyle.Bold = False
    Call rtitem.AppendStyle(richStyle)
    Call rtitem.addnewline(1)
    Call rtitem.appendtext(parentitem.text+" -/- "+childitem.text)
    Call rtitem.addnewline(2)
   End If
  End If
 End Forall
 
 'setting the second heading
 richStyle.Underline = True
 richStyle.Bold = True
 Call rtitem.AppendStyle(richStyle)
 Call rtitem.addnewline(2) 
 Call rtitem.appendtext("Items only on the Parent Document")
 richStyle.Underline = False
 richStyle.Bold = False
 Call rtitem.AppendStyle(richStyle)
 Call rtitem.addnewline(2)
 
 'second test - all items on the parent that aren't on the child
 Forall k In parent.items
  itemname = k.name
  Set parentitem = parent.getfirstitem(itemname)
  If Not child.hasitem(itemname) Then
   richStyle.Bold = True
   Call rtitem.AppendStyle(richStyle)
   Call rtitem.appendtext(itemname)
   richStyle.Bold = False
   Call rtitem.AppendStyle(richStyle)
   Call rtitem.addnewline(1)
   Call rtitem.appendtext(parentitem.text)
   Call rtitem.addnewline(2)
  End If
 End Forall
 
 'setting the third heading
 richStyle.Underline = True
 richStyle.Bold = True
 Call rtitem.AppendStyle(richStyle)
 Call rtitem.addnewline(2) 
 Call rtitem.appendtext("Items only on the Conflict Document")
 richStyle.Underline = False
 richStyle.Bold = False
 Call rtitem.AppendStyle(richStyle)
 Call rtitem.addnewline(2)
 
 'Third test - all items on the child that aren't present on the parent
 Forall j In child.items
  itemname = j.name
  Set childitem = child.getfirstitem(itemname)
  If Not parent.hasitem(itemname) Then
   richStyle.Bold = True
   Call rtitem.AppendStyle(richStyle)
   Call rtitem.appendtext(itemname)
   richStyle.Bold = False
   Call rtitem.AppendStyle(richStyle)
   Call rtitem.addnewline(1)
   Call rtitem.appendtext(childitem.text)
   Call rtitem.addnewline(2)
  End If
 End Forall
 
 report.sendto = session.username
 report.subject = "Save Replication Conflict Report"
 
 Call report.send(False)

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Database
Quickly scan all databases on a Lotus Domino server
LotusScript code rebuilds corrupted busytime.nsf file
How to move Notes databases off Domino 8 servers and save disk space
Top 10 Lotus Notes/Domino administration tips of 2008
Batch file runs scheduled Lotus Notes database maintenance tasks
Fix and update Lotus Notes documents with limited access
Programmatically replace the design of Lotus Notes databases
Add a program doc to compact Lotus Notes databases automatically
More efficient local Lotus Notes database replication
Remove orphaned Lotus Notes documents on Domino databases with a 'virtual delete'

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts