LotusScript Lists are handy, but, if you've not used them for donkey's years and have completely forgotten how they work, then finding a refresher example can be hard.
I was in this position last week. I knew a List was the solution I needed, but could I find a decent reference on their use? Nope!
So, for my own benefit as much as future Googlers, here's a quick guide to the key principles involved in using them:
Dim Groups List As String Dim key As String, value As String Set doc = collection.GetFirstDocument() While Not(doc Is Nothing) If Not IsElement(Groups(doc.GroupUNID(0))) Then Groups(doc.GroupUNID(0)) = doc.GroupName(0) End if Set doc = collection.GetNextDocument(doc) Wend 'Now - here's how to loop through the List! ForAll Group In Groups key = ListTag(Group) 'UNID value = Groups(ListTag(Group)) 'Name Print key + " = " + value End ForAll
Might seem like an odd piece of code, but it's what I needed to do -- build a unique list of groups linked to a collection of Notes document and then for each of the groups do some other logic. Don't ask.