CreateView Navigator /

There is a change in the LotusScript ViewNavigator class that has affected a couple of our custom templates. In short, looping through a navigator of categories and documents, can cause all documents after the first category to be skipped depending on how the code was written. Basically, there is a way to only end up w/ the first category’s documents. It is affecting nav.GetNextCategory and nav.GetNextSibling. IBM has just created a SPR for it: SPR # OIHZ7NAPDQ.

I’m posting our workaround, so the other developers can check their code or easily find this post.

If only the categories are navigated, this works, before the 8.02 to 8.5 upgrade and now:

Dim v as NotesView

Dim nav as NotesViewNavigator

Dim albumE as NotesEntry

Dim imageE as NoetsEntry

Set v = db.GetView(lupMyView)

Set nav = v.CreateViewNav()

Set albumE = nav.GetFirst()

While Not (albumE is Nothing)

Set albumE = nav.GetNextCategory(albumE)

Wend

However, the old code also looked at the documents w/in the categories. This is what broke during the upgrade:

Dim v as NotesView

Dim nav as NotesViewNavigator

Dim albumE as NotesEntry

Dim imageE as NoetsEntry

Set v = db.GetView(lupMyView)

Set nav = v.CreateViewNav()

Set albumE = nav.GetFirst()

While Not (albumE is Nothing)

Set imageE = nav.GetNextDocument(albumE)

While Not (imageE Is Nothing)

Set imageE = nav.GetNextSibling(imageE)

Wend

Set albumE = nav.GetNextCategory(albumE) ’ GetNextSibling did not work either

Wend

What we did to fix the now broken code was create two navs:

Dim v as NotesView

Dim nav as NotesViewNavigator

Dim nav1 as NotesViewNavigator

Dim albumE as NotesEntry

Dim imageE as NoetsEntry

Set v = db.GetView(lupMyView)

Set nav = v.CreateViewNav()

Set albumE = nav.GetFirst()

While Not (albumE is Nothing)

catnm = entry columnvalues(0) ’ the name of the category

Set nav1 = v.CreateViewNavFromCategory(catnm)

Set imageE = nav.GetFirst()

While Not (imageE Is Nothing)

Set imageE = nav.GetNextSibling(imageE)

Wend

Set albumE = nav.GetNextCategory(albumE)

Wend

Tripp Black

Mindwatering Lotus Notes Development

http://www.mindwatering.com

Subject: … We have reproduced the problem

We have reproduced this problem and are investigating a fix.

Subject: Hopefully this will be resolved soon - this is a show-stopper for us.