When passing values to all descendants in LotusScript, the Responses property only gives you immediate responses. But if you want to get all descendants and then "stamp all" the values you want, you can't. That's where this LotusScript code comes in.
'Before calling function you need to initialize with zero documents "colAllDescendants" collection using the next sentence. Set colAllDescendants = dbCurrent.Search("",Nothing,0) 'Fake search Sub GetAllDescendants(doc As NotesDocument, colAllDescendants As NotesDocumentCollection) Dim colChildren As NotesDocumentCollection Dim dChildren As NotesDocument Set colChildren = doc.Responses Set dChildren = colChildren.GetFirstDocument While Not(dChildren Is Nothing) 'Adding document to descent Call colAllDescendants.AddDocument(dChildren) 'Getting granchilds Call GetAllDescendants(dChildren,colAllDescendants) 'Procesing next son Set dChildren = colChildren.GetNextDocument(dChildren) Wend End Sub
You will get this to speed up when you're using a view that contains "$REF" -- sorted as the first column and when you perform a search with GetDoucumentByKey. My experience is that responses are very slow in large databases.
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip library by member Leandro F. Please let others know how useful it is via the rating scale at below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our tip contest and you could win a prize.