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 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.
ExpireHours
Long. The amount of time, in hours, to retain the a DocumentCollection saved for future DQL reference. Default is 24 hours if omitted.
Return value
NotesDocumentCollection
Example
Dim Query$ as String
Dim NotesDatabase db
Dim TheQuery As NotesDominoQuery
Dim doccol As NotesDocumentCollection
Dim ResultName As String
Dim ExpireHours As Long
Set db = Session.getdatabase("my.nsf")
Set TheQuery = db.Createdominoquery()
Set Query$ = "firstname = 'Annabelle' and lastname = 'Stevens' and 'Personview'.dept = 'Sales'"
Set ResultName = "MySavedResults"
Set 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)