Manage Learn to apply best practices and optimize your operations.

A list of lists

This tip describes how to return a list of lists on your system.

Those of us that have learned the benefits of lists love to use them, but sometimes a list just doesn't fit the bill. What if you need a "list of lists"?

You can do it by just assigning a list to a list of variants. And make it all dynamic, too...

This example illustrates how to use the technique. It is categorizing a two dimensional array into a list of lists, then printing the results.


 Sub Initialize %REM This agent creates a list of lists of the groups and groupmembers. %END REM Dim s As New notesSession Dim person As String Dim groupname As String Dim groups List As Variant ' LIST of group names (and LIST of arrays) Dim members List As String ' LIST of member names Dim existmembers As Variant ' utility ARRAY to temporarily hold lists Dim source(2,4) As String Dim ourname(2) As String Dim x As Integer Dim i As Integer ' set up the sample arrays ourname(0) = "tom" ourname(1) = "mike" ourname(2) = "mary" source(0,0) = "blue" source(0,1) = "red" source(0,2) = "white" source(0,3) = "gold" source(0,4) = "black" source(1,0) = "indigo" source(1,1) = "blue" source(1,2) = "black" source(1,3) = "purple" source(1,4) = "green" source(2,0) = "blue" source(2,1) = "pink" source(2,2) = "yellow" source(2,3) = "gold" source(2,4) = "black" 'loops to set up the demo For x = 0 To 2 person = ourname(x) For i = 0 To 4 groupname = source(x, i) '*********************demo code ********************************** If Iselement(groups(groupname)) Then ' use a variant to hold an existing list existmembers = groups(groupname) existmembers(person) = person groups(groupname) = existmembers Else ' create a new list and assign it to a list of variants members(person) = person groups(groupname) = members End If Erase members '*********************demo code ********************************** Next Next ' print the demo results Forall y In groups existmembers = y result = "Group " + Listtag(y) + " contains: " Forall z In existmembers result = result + Listtag(z) + ", " End Forall Print result End Forall End Sub

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

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 ...

SearchDataCenter

SearchContentManagement

Close