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.
Defined in
Syntax
Set myview = qrp.ExecuteToView( Byval name As String, Optional Byval Expirehours As Long, Optional Readers as Variant)As NotesView
Parameters
name
String. The name of the results view to create and populate.
Expirehours
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.
Readers
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.
Usage
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.
- 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.
- 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.
- 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.
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()
wend