< Back

Document Subject: Updating a view in the back end. (Which will speed up views for users)
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#ViewRefresh or http://A555F9/nn.nsf/ByAlias/ViewRefresh

After updating a large database with user information, I found that the first user of the view, which will only change after this update, has a while to wait. The second use is fine.




It seems that you can make the Notes server refresh the view in the backend and so save the user the hassle.

 

The way I did this was to reassign the view variable to another view and the reassign it back, to presumably refresh the cache of the view, and then stick in another view.refresh for good measure.

 

'if the view is set to ($Users) already set it to another one

set view=db.getview("another view you'll think of one")

'refresh $Users view to prevent first slow use

Set view = db.getview ("($Users)")    
If view Is Nothing Then
       'oops where is view?
Else
       Call view.refresh
End If

'refresh WEBNames view to prevent slow first use
Set view = db.getview ("WEBNames")    
If view Is Nothing Then
    'oops where is view?
Else
   Call view.refresh
End If

 

I stick this at the end of some agents as it is much quicker for the server to do a view refresh at night than it is for the first user of the day when the server is busy.

The if view is nothing the was added later, to cope with the view being renamed or deleted at a later date.