LotusScript NotesViewEntryCollection class does not work as expected
The LotusScript NotesViewEntryCollection class does not work as expected. When iterating through the NotesViewEntryCollection, you observe that not all of the expected documents are accessed and that some documents might be accessed more than once. The typical scenario is one where the following are true:
- The relative view is categorized.
- The NotesViewEntryCollection object is used. The most common case will be when the collection is based on the AllEntries property (of the NotesView class), but issues may also be observed when the collection is based on other methods, for example the GetAllEntriesByKey method (of the NotesView class).
- The GetFirstEntry and GetNextEntry methods are used to iterate through the collection.
- One or more documents appears two or more times in the view.
- The NotesViewEntryCollection is derived using the GetAllEntriesByKey method.
- The search column has the column property "Show multiple values as separate entries" enabled.
- One, or more, documents contains multiple values in the key column, where one of the values matches the key value passed in the GetAllEntriesByKey call.
Resolving the problem
This issue has been reported to Quality Engineering as SPR# CYII74LP9A. There are no plans to address this issue. It is not recommended that the NotesViewEntryCollection class be used in cases where the relative view is categorized, or the case where a column makes use of the "Show multiple values as separate entries" property.
In the case where the column property "Show multiple values as separate entries" has an effect, the workaround is to disable the column property in the relative view. If the property is necessary, then create a second copy of the view with the property disabled, and hide the view using parentheses around the name, and adjust the code to refer to the hidden view.
In the case where a categorized view's full contents needs to be iterated through, one should use the NotesViewNavigator class. When iterating through a NotesViewNavigator object, in order to avoid category rows in the view, you can do a conditional check with the IsCategory property, or the IsDocument property, of the current NotesViewEntry object.
The following demonstrates a basic example:
Dim s As New NotesSession
Dim db As NotesDatabase
Dim nav As NotesViewNavigator
Dim entry As NotesViewEntry
Dim view As NotesView
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set view = db.getView("Cat1")
While Not(entry Is Nothing)
If Not entry.IsCategory Then
If entry.IsDocument Then
<code to act on document>
Set entry = nav.GetNext(entry)
In Notes/Domino releases prior to 6.0, the error "Entry is no longer in view: <viewname>" would occur when accessing a property or method of the NotesViewEntry class. This occurred in cases where the entry was derived from a NotesViewEntryCollection based on the GetAllEntriesByKey method (of the NotesView class), and when the relative view had a column where the following property was enabled"Show multiple values as separate entries" (found in the Column Properties dialog box --> Sort Panel [second from left]). This issue was resolved in Notes/Domino release 6.0 by a fix based on SPR# CSMH483KAX.
|Messaging Applications||IBM Domino Designer||LotusScript||Windows||8.0, 7.0, 6.5, 6.0|
Translate this page: