Hit Counts for Views

Author: Tripp W Black

Created: 08/26/1999 at 07:51 PM


Notes Developer Tips

From the IRIS newsletter:

If you have an application with several views, and want to determine which views actually get used, this tip is for you. Just follow these steps:
      1. Create a "ViewCount" form with fields named for each view in your database.
      In the Queryopen event of each view, enter the following code for incrementing a counter on your "ViewCount" form:

Sub Queryopen(Source As Notesuiview, Continue As Variant)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set doc= db.GetDocumentByUNID ("C95A32790A9564CE8625663B00684143")

Dim Currentvalue As String
Dim Currentvaluenum As Integer
Call Doc.save(False,False)
End Sub

Then, whenever users open a view (View1), the corresponding View1 field on the ViewCount form is incremented by one. The ViewCount form is accessed through the GetDocumentByUNID method.

Regarding the users' access level in the database, you have two options. If the users of the database do not have Editor access, you can place the ViewCount form in a separate database where users do have Editor access, since they will be updating the values. Or, alternatively, you can select the Form property "Available to Public Access users" (on the Security tab), and then select "Write Public documents" access for all users with Reader access in the database ACL.

After a few weeks, you can simply open your ViewCount document to get a good idea of which views actually get used in your application.

It is possible for the document counts to be less than the number of times each view was opened, because if the document save fails, the information is discarded.


David Williams is a senior Notes consultant for Taylor Management Systems, and is currently working on a Y2K tracking application for IBM Global Services/Network Services in Schaumburg, IL. David has been working with Notes for four years in Lexington, KY and the Chicago area.

previous page