I am trying to write a LotusScript agent that processes against a view of parent documents and for each parent document uses the universalID to see if there are any response documents.
%REM
Agent Search_For_ActionItemIssues_Responses
Created Nov 16, 2010 by Gary Ashford/GV/FD/FluorCorp
Description: Comments for Agent
%END REM
Option Public
Option Declare
Sub Initialize()
Dim db1 As NotesDatabase
Dim doc1 As NotesDocument
Dim s1 As New NotesSession
Dim view1 As NotesView
Dim collection1 As NotesDocumentCollection
Dim strID As String*32
Dim searchFormula As string
Set db1 = s1.currentdatabase
Set view1 = db1.getview("MainTopicLookup")
Set doc1 = view1.getfirstdocument
While Not(doc1 Is Nothing)
strID = doc1.UniversalID
MessageBox "UniversalID=" + strid
’ searchFormula = |Form = “ActionItemIssue” & $Ref = strID)|
’ searchFormula = |Form = “ActionItemIssue” & $Ref = @DocumentUniqueID)|
’ searchFormula = |Form = “ActionItemIssue” & @Text($Ref) = " | + strID + |" |
searchFormula = |Form = "ActionItemIssue" & @Contains(@Text($Ref);" | + strID + |") |
Set collection1 = db1.Search(searchFormula, Nothing,0)
MessageBox "collection_resp count=" + CStr(collection1.count)
Set doc1=view1.GetNextDocument(doc1)
Wend
End Sub
As you can see, I have tried several search formulas and never get a match, even though there are response (ActionItemIssue) documents in the database.
I have used debug and everything looks good, but I am not getting any matches.
Any help would be greatly appreciated.