This agent creates a new document based off the document whose items you wish to examine. All item names and text values are compiled in a report.
It is coded as an agent to work with your mail d.b. and triggered off selected documents in a view. The report document is then placed in your inbox. You can tweek a few lines and use the code in any d.b. you wish.
Code: Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim testdoc As NotesDocument
Dim Body As NotesRichTextItem
Dim tempRTitem As NotesRichTextItem
Dim getItem As NotesItem
Dim theSub As String
Dim itemname As String
Dim itemType As Integer
Dim rtitemText As String
Dim richStyle As NotesRichTextStyle
Dim richStyle2 As NotesRichTextStyle
Set db = session.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set richStyle = session.CreateRichTextStyle
richStyle.NotesFont = FONT_COURIER
richStyle.FontSize = 10
richStyle.Bold = True
Set richStyle2 = session.CreateRichTextStyle
richStyle2.NotesFont = FONT_COURIER
richStyle2.FontSize = 8
richStyle2.Bold = False
NumSel = dc.Count
For j = 1 To NumSel
Set doc = dc.GetNthDocument(j)
theSub = doc.GetItemValue("Subject")(0)
Set testdoc = New NotesDocument(db)
testdoc.Form = "Memo"
Set Body = New NotesRichTextItem(testdoc,"Body")
testdoc.Subject = ("Document Synopsis for: " & theSub)
Forall i In doc.items
itemType = i.Type
' itemValues(Ucase(i.Name)) = i.Text
itemname = i.Name
If itemType = 1 Then
Set tempRTitem = doc.GetFirstItem(itemname)
rtitemText = tempRTitem.GetFormattedText(True, 60)
Call Body.AppendStyle(richStyle)
Call Body.AppendText(Chr(10) & itemname & ": " & Chr(10))
Call Body.AppendStyle(richStyle2)
Call Body.AppendText(rtitemText & Chr(10))
Else
Call Body.AppendStyle(richStyle)
Call Body.AppendText(Chr(10) & itemname & ": " & Chr(10))
Call Body.AppendStyle(richStyle2)
Set getItem = doc.GetFirstItem(itemname)
Forall v In getItem.Values
Call Body.AppendText(Cstr(v) & Chr(10))
End Forall
End If
End Forall
Call testdoc.Save(True, False)
Call testdoc.PutInFolder("($Inbox)")
Next
End Sub
This was first published in December 2000