[Last Call] Learn how to a build a cloud-first strategyRegister Now


Dynamic multi-dimension array in LotusScript

Posted on 2006-03-23
Medium Priority
Last Modified: 2013-12-18
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?

Question by:Ed_CLP
1 Comment
LVL 18

Accepted Solution

marilyng earned 500 total points
ID: 16276416
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)


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question