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

NotesDominoQuery

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

Long. The amount of time, in hours, to retain the a DocumentCollection saved for future DQL reference. Default is 24 hours if omitted.
Note: The Domino updall command used with the -j option provides options for managing named results. For more information, see the Domino documentation.

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)

Language cross-reference

execute method (DominoQuery - Java)