Autor Thema: Counter für Views  (Gelesen 2748 mal)

Offline _Arne_

  • - Admin Section -
  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 992
  • Geschlecht: Männlich
  • Devops Because Even Developers Need Heroes
    • Das Lotus Notes Forum
Counter für Views
« am: 21.01.02 - 11:52:47 »
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.
2. 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
Currentvalue=Doc.View1(0)
CurrentvalueNum=Cint(Currentvalue)
CurrentvalueNum=Currentvaluenum+1
Doc.View1=Cstr(CurrentvalueNum)
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.

Note: 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.
« Letzte Änderung: 01.01.70 - 01:00:00 von 1034200800 »

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz