ExecuteToView (NotesQueryResultsProcessor - LotusScript)

Saves sorted QueryResultsProcesser results to a "results view" in a database. Processes the input collections in the manner specified by the Sort Columns, overriding field values with formulas specified via addFormula calls. Creates a results view in a host database and returns View object.

From Domino 14.0.0 onwards, you have the ability to customize the design of a created view by specifying a view name and database to copy the design from. If the source view includes a column named $QRPDefaultColumn, this column's design will be used for any new columns added by the .addColumn() method. Otherwise, the design of the last unhidden column will be used. To override the properties of one of the specified view's columns, you can call .addColumn() with the name of that column. The specified view's column formulae will be used, unless overridden by the formula argument of .addColumn() or by .addFormula(). The specified view remains unchanged and is copied, resulting in the creation of a new view.

Defined in



Set myview = qrp.ExecuteToView( Byval name As String, Optional Byval Expirehours As Long, Optional Readers as Variant, Optional DesignSrcDB As NotesDatabase, Optional byval DesignSrcViewName As String) As NotesView



String. The name of the results view to create and populate.


Long. The time, in hours, for the view to be left in the host database. If not specified, it expires in 24 hours. You can extend the expiration time using the updall or dbmt tasks.


A variant, either a single name in a String or an array of Strings containing names. These define the allowed Readers for the documents in the View. Each value must be in canonical format.


The database where DesignSrcViewName is stored. If null, the function will check the database associated with the calling object.


The name of the view whose design to copy. Use the specified view as the source design for the QRP view to be created. If null or empty, a default design is used.


Results views created using the ExecuteToView method have the following distinctive characteristics. To open and manipulate results views using the HCL Notes® client or to write application code that utilizes it, it's important to understand these characteristics.

Results views are created and persist in a database that you choose. Using a separate, non-production database is recommended. Doing so avoids unnecessary, routine database processing and also avoids user confusion over the views, which are not standard views.

Results views are generated programmatically, so they are designed to be discarded after use. Therefore:
  • They do not refresh automatically. If you want more recent data, you need to delete the old view using a method to remove in the View class or by running updall with the -Tx option, and then recreate and repopulate the view.
  • They are automatically deleted during updall and dbmt task maintenance after their expiration time elapses.
Results views contain unique NoteIDs that cannot be referenced. Therefore:
  • They do not generate document properties data in the Notes client.
  • You can't open them using normal mouse gestures in the Notes client.
  • You can't use full text indexing to search them; they are the results of such searches.
  • You can use API calls that use those NoteIDs only within the context of the results views.
  • They include hidden columns that contain the database path and the true NoteID for each originating document. You can access this information using view column processing.
Security for results views is implemented at the view level:
  • By default, only the person or server creating the view can read the view data.
  • You can use the Readers parameter to define a reader list.
  • A person or server with access to the view gets access to all document details and aggregate values; there is no mechanism to restrict this access.

Domino processing of results views is otherwise typical.

You can use Domino Designer to edit results views, with the exception of selection criteria and view formulas, which are specified when the views are created.

Note: Use the Domino Show database command with the -e option to list the size and expiration time of each results view in a database.

Example 1: Using ExecuteToView

Dim theReaders (1 to 4) as String
theReaders (1) = “CN=User1 UserLN1/O=MYORG”
theReaders (2) = “CN=User2 UserLN2/O=MYORG”
theReaders (3) = “PrivilegedGroup”
theReaders (4) = “CN=User3 UserLN3/O=MYORG”
Dim s As New NotesSession
Dim db As NotesDatabase
Dim qrp As NotesQueryResultsProcessor
Dim myview As NotesView
Set db = s.GetDatabase("myserver", "mydb.nsf")
Set qrp = db. CreateQueryResultsProcessor()

‘ .. AddColumn, AddDominoQuery, AddFormula, etc.

‘ That is, 2 hours to expiration, view name is MyNewResultsView

Set myview = qrp.executeToView(“MyNewResultsView”, 2, theReaders);

\‘ .. view processing

Example 2: Using the hidden view columns $DBPath and $NoteID

Dim pathelem As Integer
Dim nidelem As Integer
Dim dbPath As String
Dim realnid As String
Dim colvals as Variant
Dim v as NotesView
Dim vec as NotesViewEntryCollection
Dim ve as NotesViewEntry
Set dir = s.GetDbDirectory("")
Set db = dir.OpenDatabase("QRPHostDB.nsf")
Set v = db.GetView("Main Results View")
‘ For the view “Main Results View” it is known that 
‘      $DBPath column is the 5th         and
‘      $NoteID column is the 6th
Set pathelem = 5
Set nidelem = 6
For Each cn In v.ColumnNames
  count = count + 1
Set vec = v.GetAllEntries()
Set ve = vec.GetFirstEntry()
While NOT (ve is Nothing)
‘  Note – the NoteID property is useless since documents reside in other databases
   Set dbPath = ve.ColumnValues(pathelem)
   Set realnid = ve.ColumnValues(nidelem)
‘ .. Whatever database open and document processing is desired
   Set ve = vec.GetNextEntry()

Example 3: Creating a view with a specific design

Set qrp = db.createDominoQuery()

‘ SrcDB contains a view named “MyCoolView” which will serve as the template for the design of our newly created view 
Set SrcDB = session.GetDatabase(“serverName”, “DBName”)

‘ oldColumn already exists in MyCoolView, we are renaming the title here
Call qrp.addColumn(“oldColumn”, “newTitle1”)

‘ newColumn does not exist in MyCoolView, we create it here
Call qrp.addColumn(“newColumn”, “newTitle2”)

‘ call executeToView where SrcDB is the DB where MyCoolView is stored
‘ MyCoolView contains columns with custom colors and fonts
Set myNewView = qrp.executeToView(“NewQRPViewName”, 0, null, SrcDB, “MyCoolView”)