Manage Learn to apply best practices and optimize your operations.

Using the GetAllDescendants Sub in LotusScript

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 from SearchDomino.com member Leonel Zanetti comes in.

VIEW MEMBER FEEDACK TO THIS TIP

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

MEMBER FEEDBACK TO THIS TIP

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.
—Christian M.

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.

Dig Deeper on LotusScript

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