LOTUSSCRIPT/COM/OLE CLASSES
Examples: UnprocessedFTSearch method
1. This view action script allows a user to perform a full-text search on the currently selected documents in the view. UnprocessedFTSearch returns the documents currently selected in the view that contain the word "botany," and places them into a folder.
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set collection = db.UnprocessedFTSearch( "botany", 0 )
For i = 1 To collection.Count
Set doc = collection.GetNthDocument( i )
Call doc.PutInFolder( "Botanist's Delight" )
Next
End Sub
2. This agent script runs on all newly created and modified documents that contain the word "botany." Its purpose is to modify the Status item of each document it processes.
If the agent does not contain any searches defined in the Agent Properties box, and runs for the first time on October 17, 1995, UnprocessedFTSearch returns all the documents in the database that contain the word "botany." The script puts "Processed by agent on 10/17/95" into the Status item of each returned document, saves the document, and marks it as processed. If the agent runs again the next day, and five documents have been created or modified since the 17th, UnprocessedFTSearch searches only those five documents -- all other documents have been marked as processed -- and returns those that contain "botany." The script puts "Processed by agent on 10/18/95" into the Status item of each returned document. If the agent runs again the next day, and one document has been created since the 18th, UnprocessedFTSearch returns the document only if it contains "botany"; otherwise, it returns a NotesDocumentCollection with zero documents.
If the agent does contain searches defined in the Agent Properties box, and runs for the first time on October 17, 1995, UnprocessedFTSearch returns all the documents in the database that meet the search criteria defined in the Agent Properties box
and
that contain the word "botany." If the agent runs again the next day, and five documents have been created or modified since the 17th, but only two of them meet the search criteria defined in the Agent Properties box and contain the word "botany," UnprocessedFTSearch returns those two documents. If the agent runs again the next day, and one document has been created since the 18th, but it does not meet the search criteria defined in the Agent Properties box, or does not contain the word "botany," UnprocessedFTSearch returns an empty NotesDocumentCollection.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim dateTime As NotesDateTime
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set collection = db.UnprocessedFTSearch( "botany", 0 )
Set dateTime = New NotesDateTime( "Today" )
Set doc = collection.GetFirstDocument()
While Not(doc Is Nothing)
doc.Status = "Processed by agent on " & _
dateTime.LocalTime
Call doc.Save( True, True )
Call session.UpdateProcessedDoc( doc )
Set doc = collection.GetNextDocument(doc)
Wend
End Sub
3. This agent script runs on all unread documents that contain the word "URGENT," and puts these documents into a folder.
If the agent does not contain a search defined in the Agent Properties box, UnprocessedFTSearch returns all unread documents in the database that contain the word "URGENT," regardless of whether the agent has already run on some of the unread documents at an earlier time.
If the agent does contain searches defined in the Agent Properties box, UnprocessedFTSearch returns all unread documents in the database that meet the search criteria defined in the Agent Properties box and that contain the word "URGENT," regardless of whether the agent has already run on some of the unread documents at an earlier time.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set collection = db.UnprocessedFTSearch( "URGENT", 0 )
Set doc = collection.GetFirstDocument()
While Not(doc Is Nothing)
Call doc.PutInFolder_
( "Stop dreaming! Read these documents!",True )
Set doc = collection.GetNextDocument(doc)
Wend
End Sub
See Also
UnprocessedFTSearch method
Glossary
Help on Help
Open Full Help Window
Glossary
Help on Help
Open Full Help Window