New Response

« Return to the blog entry

You are replying to:

    • avatar
    • Mark Leusink
    • Posted on Thu 11 Mar 2010 06:01 AM


    I'm also using a WebSession-like base class in all of my Lotusscript agents. One of the problems I ran into to was that in different functions/subs I needed a handle to the same view(s).

    Instead of adding variables to the base class for every view I needed, I added a private list variable to the class and added a function to retrieve a view. In the function I check if the specified view was retrieved previously. If it is, the existing handle is returned. If it´s not, the view is retrieved, added to the list and than returned:

    retrievedViews_ List As NotesView

    Public Function getView( strViewName$ ) As NotesView

    If Not Iselement( Me.retrievedViews_( strViewName ) ) Then

    Set Me.retrievedViews_( strViewName) = Me.db.GetView( strViewName )

    End If

    Set getView = Me.retrievedViews_( strViewName )

    End Function

    (Me.db is a private NotesDatabase variable filled with the current database when instantiating the class)

    Besides views you can also use this solution for documents or database handles you need in multiple locations. The getView function can also easily be extended to retrieve views from other databases.

Your Comments