Dynamic multi-dimension array in LotusScript

I need to loop through a document collection and store 7 field values form each document. I know that there will always be 7 fields, but the number of documents is determined at run time.  I tried dim TestArray(1 To x, 1 To 7), but this throws an error.  If I put a fixed number in place of variable x it work fine.  I also need to sort the array on field 1 after reading the document collection.
Can this be done in LotusScript?  Can anyone provide example code?

Thanks
Ed_CLPAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

marilyngCommented:
Hi Ed_CLP,
Sure, you dim first as dynamic, then when you know the bounds you redim.

Dim Session As New NotesSession
    Dim db As NotesDatabase
    Set db = session.currentdatabase
    Dim doc As NotesDocument
    Dim coll As NotesDocumentCollection
    Dim theList() As String
    Set coll = db.unprocesseddocuments
    If coll.count <1 Then Exit Sub
    Dim k As Long, n As Long
    n = 7
    k = coll.count
    Redim theList(0 To K, 1 To n) As String    
    k = 0
    Set doc = coll.getfirstdocument
    While Not doc Is Nothing        
        With doc
            Print "Processing " + Cstr(k)
        End With
        k = k+1
        Set doc = coll.GetNextDocument(doc)
    Wend

Regards!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.