wissel.net

Usability - Productivity - Business - The web - Singapore & Twins

Comparing document changes


From time to time I have the need to compare the documents of two databases for changes:
  • Before I clean-up a Domino configuration I create a backup copy (File - Application - New Copy). Once I'm done I generate the report of changes made - reliably without missing a field
  • We suspect data was altered by a rookie user. Using a backup copy all the changes made need to be highlighted
  • Suspecting that a replication went awry I want to compare two instances of one database on different servers
For these use cases I wrote a class that allows me to blend out certain fields or documents based on certain forms. The code is a rough cut and you might need to adjust it to specific needs. Anyway enjoy:
PublicClass CompareEnging
   
    SubNew(sServer AsString, sDB AsString, tServer AsString, tDB AsString)
   
    PublicPropertySet reportOnlyChangedFields AsBoolean
    PublicPropertySet eMailResults AsBoolean
    PublicSub addExcludedForm (formName AsString)
    PublicSub addExcludedField (fieldName AsString)
    PrivateFunction fixTextforHTML (orgText AsString)AsString
    PublicFunction report
    Sub reportNewDocuments (targetDB AsNotesDatabase)
    Sub compareTargetDoc (tDoc AsNotesDocument)
    Sub compareSourceDoc (sDoc AsNotesDocument, tDB AsNotesDatabase)
    Function documentSingleDoc (doc AsNotesDocument, txtStatus AsString)
    PublicSub compareTwoDocuments (sDoc AsNotesDocument, tDoc AsNotesDocument)

EndClass

Function ReplaceSubstring (sourcestr AsString, fromstr AsString, tostr AsString)AsString
Download the Full Source code. As usual - YMMV

Posted by on 27 March 2011 | Comments (2) | categories: Show-N-Tell Thursday

Comments

  1. posted by Roy Rumaner on Monday 28 March 2011 AD:
    Sounds like you wrote a very basic version of ScanEZ from Ytria.
  2. posted by Stephan H. Wissel on Monday 28 March 2011 AD:
    @Roy: Yes, absolutely right. 3 differences:
    - it is way more basic
    - the output is a HTML table only
    - I can leave it behind with a customer