Execute method (NotesDominoQuery - LotusScript)
Executes a query string passed in according to set parameters and returns named results in a database where they can be accessed again more quickly. For reuse of complex queries, this saves significant processing time.
Defined in
Syntax
Set doccol = NotesDominoQuery.Execute(Query$, Optional String ResultName, Optional Boolean Replace, Optional Long ExpireHours)
Parameters
Query$
String. A query in DQL syntax.
ResultName
String. The name to use to save a DocumentCollection in the database for future DQL reference. The name is case-sensitive.
Replace
Boolean. If a saved DocumentCollection with ResultName exists, overwrite it. If not set, an error is thrown indicating a conflict.
ExpireHours
Return value
NotesDocumentCollection
Example
Dim Query As String
Dim db As NotesDatabase
Dim TheQuery As NotesDominoQuery
Dim doccol As NotesDocumentCollection
Dim ResultName As String
Dim ExpireHours As Long
Dim Session As New NotesSession
Set db = Session.getdatabase("", "my.nsf")
Set TheQuery = db.Createdominoquery()
Query$ = "firstname = 'Annabelle' and lastname = 'Stevens' and 'Personview'.dept = 'Sales'"
ResultName = "MySavedResults"
ExpireHours = 72
' Runs the query, returns results in doccol and saves them for future reference (DQL in clause)
' in "MySavedResults", a named set of documents that will be deleted by updall in 72 hours
Set doccol = TheQuery.Execute(Query$, ResultName, ExpireHours)