Manage Learn to apply best practices and optimize your operations.

Notes client view hit counter

How to create a Notes client view hit counter.

Have you ever inherited an application that you did not build? It's big, slow, and for some reason there are 95 views in it, many of which are named 'Copy of ...', 'Another Copy of ...' and 'zDeveloperView...' that you suspect are not being used any more. Would it be nice to know if the user population is still using a particular view? Getting rid of those extra, unused views can reduce the size of the database view index, helping your application's performance. Here is a simple method to determine if a view is being used, and how often.

Note: This method only counts user hits for users with a database access level of Editor or above, as Readers and below cannot edit the Profile Document.

Create a profile form. I will call it ViewHitProfileForm. Create a two-column table and enter all the view names and one field next to each view name that you need to track. The fields can be editable - text. Let us say we are tracking three views: View1Hits
Save the form.

Create an agent to edit the profile document.
Name: Edit ViewHitProfileForm
When should the agent run? Manually from Agent List
Which documents should it act on? Run once. (@Commands may be used)
Run Formula: @Command([EditProfile];"ViewHitProfileForm") Save the agent and run it to create and edit the profile document. You must enter a zero in each field or you will encounter errors. Save the newly created profile document.

Go to the design of each view and enter the following code in the PostOpen event:
@If(@TextToNumber(@Left(@UserAccess(@DbName);1)) < 3; Return(""); "");
temp:=@TextToNumber(@GetProfileField("ViewHitProfileForm";"View1Hits")) +1;
Make sure to change the number on View1Hits to 2 and 3, depending on the view.
This code will retrieve the number of view hits from the profile document, increment it by one and then set it again in the profile document.

Any time you want to see how many hits the views have, simply run the agent and print the profile document. You can also reset the counters to zero to collect monthly or weekly statistics on view use. This can help focus future development efforts on the most heavily used views and also help you eliminate infrequently used views without guesswork.

If you need to track the last user of the view you could enter another field on the profile form called View1User. Then you could add the following code to record the username of the person who last accessed the view.

This was last published in June 2001

Dig Deeper on Domino Resources - Part 7

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...