This tip is a simple little tool that just creates a CSV file of the contents of a document (i.e., fieldname, val1, val2, valn, etc.). I have found it useful in diagnosing problems. The result can be loaded into Excel, and you can then use it to locate changes in doc fields.
Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim collection As NotesDocumentCollection Dim doc As NotesDocument Set db = session.CurrentDatabase Set collection = db.UnprocessedDocuments Set doc = collection.GetFirstDocument() Dim messagestring As String FileName = Left(Cstr(db.FileName), Len(Cstr(db.FileName))-3) File2 = "C:DocExport-" & FileName & "csv" fileNum% = Freefile() Open File2 For Output As # fileNum% Forall i In doc.Items messageString = "" If i.type = 1 Then 'Is rich text desplay the text version messageString = ",RichText " + i.text Else Forall o In i.values 'Now check for an array) If Cstr(o) = "" Then messageString = MessageString +" , " + "Null Value
Found" Else messageString = MessageString +" , " + Cstr(o) End If End Forall End If Print #fileNum%,i.name +MessageString End Forall result = Shell("notepad.exe " & Cstr(File2), 1) End Sub
There is also a Notes Document Viewer database in the sandbox on the Lotus site that will let you search through all fields in a document. It was created by Frank Paolino of maysoft.com. I've found this very useful and it doesn't require an agent.
-- Chris K.
Do you have comments on this tip? Let us know.