Manage Learn to apply best practices and optimize your operations.

List field values of several documents in alphabetical order

This tip will let you select one or more documents and export all its field values in alphabetical field order.

'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%, ""

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
            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
        Hi = J
    Loop Until J = 0
End Sub

This was last published in May 2001

Dig Deeper on Domino Resources - Part 7

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...