is there a way to get the usage of the view? How can I find out if the use is used? How often? By whom?
Subject: Usage of the View
I do not remember anything quite like that. If a view has not been used in 45 days (or however long it is set), the view index will be deleted. Unfortunately, the index will get built even if someone stumbles into the view trying to get to another view.
If it is critical, you could do your own logging. Add some LS to the postopen event of the view.
You can see user activity (not per view) in the database properties. You can see some database usage info in the log.nsf. You can see view sizes in the log.
Subject: RE: Usage of the View
OK, I did it - works great! If anybody need it, here it is:
-
Created a Form called “(View Usage Log | VUL” with the following fields: ViewName, ViewUserName, EntryTime, ExitTime, UsedFor. All the fields are Computed when composed and formula is the same as the name of the field. EntryTime and ExitTime - Date/Time format, everything else is text.
-
In the view(s):
(Declarations)
Dim docID As String
Dim db As Notesdatabase
Dim ViewLogDoc As NotesDocument
Sub Postopen(Source As Notesuiview)
Set session = New NotesSession
Set db = session.CurrentDatabase
Dim workspace As New NotesUIWorkspace
Dim view As NotesUIView
Set view = workspace.CurrentView
Set ViewLogDoc = db.createdocument
ViewLogDoc.form = "VUL"
ViewLogDoc.ViewName = view.ViewName
ViewLogDoc.EntryTime = Now
Dim userName As New NotesName(session.UserName)
ViewLogDoc.ViewUserName = userName.Common
Call ViewLogDoc.Save(True,True)
docID = ViewLogDoc.UniversalID
End Sub
Sub Queryclose(Source As Notesuiview, Continue As Variant)
Set ViewLogDoc = db.GetDocumentByUNID( docID )
If ViewLogDoc Is Nothing Then
Exit Sub
Else
ViewLogDoc.ExitTime = Now
Set EntryTime = New notesdatetime(ViewLogDoc.EntryTime(0)) ' get the entry time from Log doc
Set ExitTime = New notesdatetime(ViewLogDoc.ExitTime(0)) ' get the exit time from Log doc
DifferenceInSeconds = Round(ExitTime.TimeDifference( EntryTime), 2)
DifferenceInMinutes = Round(ExitTime.TimeDifference( EntryTime ) / 60, 2)
DifferenceInHours = Round(ExitTime.TimeDifference( EntryTime ) / 60 / 60, 2)
DifferenceInDays = Round(ExitTime.TimeDifference( EntryTime ) / 60 / 60 / 24, 2)
If DifferenceInSeconds < 60 Then
ViewLogDoc.UsedFor = Cstr(DifferenceInSeconds) + " seconds"
Elseif DifferenceInMinutes < 60 Then
ViewLogDoc.UsedFor = Cstr(DifferenceInMinutes) + " minutes"
Elseif DifferenceInHours < 24 Then
ViewLogDoc.UsedFor = Cstr(DifferenceInHours) + " hours"
Else
ViewLogDoc.UsedFor = Cstr(DifferenceInDays) + " days"
End If
End If
Call ViewLogDoc.Save(True,True)
End Sub
- Created a view Sorted and Categoried by ViewName to see the View(s) activity.