Home > Domino Tips > Developer > Agent > A list of lists
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

AGENT

A list of lists


Thomas Franks
12.16.2002
Rating: -4.62- (out of 5) Hall of fame tip of the month winner


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


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.



Code

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
 

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
Agent
Open documents in Lotus Notes from the Web without a UNID
Fix and update Lotus Notes documents with limited access
Verify scheduled agent status with Domino Extensible Language (DXL)
How to export data from a Lotus Notes database to a CSV file
Enable or disable scheduled agents without opening the Lotus Notes database design
Creating custom views in Lotus Notes databases
Editing fields in a Lotus Notes view with Ajax
How to automatically create a backup copy of your Domino Directory
Export Lotus Notes documents to Microsoft Word via Internet Explorer
A bevy of Notes/Domino development tips

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 1999 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts