'compare fields:
Option Public Option Declare Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim collection As NotesDocumentCollection Dim doc As NotesDocument Dim i As Integer, j As Integer Dim arrValue() As String Dim fileNum As Integer fileNum% = Freefile() Open "C:\temp\compare.txt" For Output As fileNum%
Set db = session.CurrentDatabase Set collection = db.UnprocessedDocuments For i = 1 To collection.Count Set doc = collection.GetNthDocument( i ) Print #fileNum%, "Document nr. " & Cstr (i) j = 0 Forall item In doc.items Redim Preserve arrValue(j) arrValue(j) = item.Name & ": " & item.text j = j + 1 End Forall
Call Bubblesort(arrValue)
Forall value In arrValue Print #fileNum%, value End Forall Print #fileNum%, "" Next
End Sub
Sub BubbleSort(A As Variant) Dim I As Long, J As Long, Hi As Long Dim Temp As Variant Dim lb As Long Dim ub As Long
lb = Lbound(A) ub = Ubound(A)Hi = ub Do J = 0 For i = lb + 1 To Hi If A(I - 1) > A(I) Then J = I - 1 Temp = A(J) A(J) = A(I) A(I) = Temp End If Next Hi = J Loop Until J = 0 End Sub
This was first published in May 2001