Examples: Query property (NotesAgent - LotusScript®)

This script gets the query for the Cleansing Agent in the current database and puts it into the variable selection.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim agent As NotesAgent
Set db = session.CurrentDatabase
Dim selection As String
agentList = db.Agents
Forall a In agentList
  If ( a.Name = "Cleansing Agent" ) Then
    Set agent = a
  End If
End Forall
selection = agent.Query

Some sample results:

  • If the Cleansing Agent searches for documents that contain the word "tulip," Query returns ("tulip").
  • If it searches for documents that contain the word tulip and were created on September 19, 1996, Query returns ("tulip") AND ([_CreationDate] = 09/19/96).
  • If it searches for documents that use the Response form, Query returns (([Form]="Response")).
  • If it searches for documents that use the Response form and contain the phrase "mustard greens" in the Subject field, Query returns (([Form]="Response")) AND ([Subject] CONTAINS (mustard greens)).