Autor Thema: Dokumentvergleich  (Gelesen 3501 mal)

Offline Rob Green

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 2.651
  • Geschlecht: Männlich
    • Meipor
Dokumentvergleich
« am: 11.04.03 - 10:25:41 »
das Thema gibbet es ja immer wieder. Anbei ein sehr nütztlicher Tip, wie man 2 Dokumente auf Unterschiede untersuchen kann:

http://www.dominozone.net/domzone/dzone.nsf/lupContents/A64B89E62498E392C1256CA70024E6A7!opendocument

(sollte der Link nicht mehr sein, die Kopie des Tips hier:
How do you compare 2 documents, and their field values? It was kind of easy back in R4. Don't remember? Well check out this tip and check out how we do it in R5 and ND6.
 

Sometimes, it might be needs to compare 2 documents, to see what the differences in them are. This could be in scenarios of replication or save conflicts. This might be very difficult, expecially if the documents are big and alot of data are inside. If Notes had a tools for this, it would make my day a alot easier, but it doesn't. So, in R4, there was a hidden tool for this purpose. Just by adding a notes.ini parameter :

AddInMenus = NNTEDIFF.DLL

- would give you a nice window comparing all the fields in 2 documents.

In R5 and ND6, this tools has been removed. The only solution now, is to create some tool yourself. The best solution, or maybe the only one, is to script something in Lotusscript. This script, below, will compare to marked documents in a view, and go through all the fields and show their values in messageboxes. This can for sure be edited, but I found it very visual and easy to use.

Sub Initialize
Dim session As New notessession
Dim ws As New notesuiworkspace
Dim db As notesdatabase
Dim uiview As notesuiview
Dim coll As notesdocumentcollection
Dim firstdoc As notesdocument
Dim seconddoc As notesdocument
Dim Item2 As notesitem
Dim differences As String
Dim x As Integer
Dim rt1, rt2 As NotesRichTextItem


' *** Only for R5/ND6 clients
Dim version As String
Dim extract As String
version = session.NotesVersion
extract = Left(version, 9)
If (extract <> "Release 6") Then
If (extract <> "Release 5") Then
Messagebox "Important: Sorry, but this agent can only be used by an R5/ND6 client.", 0 + 64, "Sorry!"
Exit Sub
End If
End If

Set db = session.currentdatabase
Set uiview = ws.currentview
Set coll = db.unProcessedDocuments

If coll.count < 2 Then
Messagebox "This process is designed to compare 2 documents",16,"Please select 2 documents"
Exit Sub
End If

' *** Get the 1st 2 selected docs, ignoring the rest
Set firstdoc = coll.getfirstdocument
Set seconddoc = coll.GetNextDocument( firstdoc )

' *** Loop through the fields on the documents
Forall i In firstdoc.Items
If Not i.Type = 1 Then ' ********* Text (or numeric) fields
Set Item2 = seconddoc.getfirstitem(i.name)

If Not Item2 Is Nothing Then
If i.valuelength > 0 Then
If Strcompare(Cstr(Item2.values(x)),Cstr(i.values(x)), 0) Then
differences = differences + i.name & ": First Value = (" & Cstr(i.values(x)) & ")" & Chr(10) & i.name & ": 2nd Value = (" & Cstr(Item2.values(x)) & ")"& Chr(10)
End If
End If
Else
differences = differences + i.name & ": First Value = (" & Cstr(i.values(x)) & ")" & Chr(10) & i.name & ": 2nd Value = (No field of this name)" & Chr(10)
End If
Else ' ******** Rich Text
Set rt2 = seconddoc.getfirstitem(i.name)

If Not rt2 Is Nothing Then
If i.valuelength > 0 Then
If Strcompare(Cstr(rt2.GetFormattedText(False, 70)),Cstr(i.GetFormattedText(False, 70)), 0) Then
differences = differences + i.name & ": First Value = (" & Cstr(i.GetFormattedText(False, 70)) & ")" & Chr(10) & i.name & ": 2nd Value = (" & Cstr(rt2.GetFormattedText(False, 70)) & ")"& Chr(10)
End If
End If
Else
differences = differences + i.name & ": First Value = (" & Cstr(i.GetFormattedText(False, 70)) & ")" & Chr(10) & i.name & ": 2nd Value = (No field of this name)" & Chr(10)
End If
End If
End Forall
If differences = "" Then
differences = "There were no differences between these two documents"
End If
Messagebox differences,0,"Comparison Results"
End Sub
 
 
Vielleicht verdirbt Geld wirklich den Charakter.
Auf keinen Fall aber macht Mangel an Geld ihn besser.
(John Steinbeck)

Meiporblog: http://www.meipor.de/blog
allg. Unternehmerblog: http://www.m-e-x.de/blog

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz