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

Dig deeper on Domino Resources - Part 7

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close