|
|
You can also use the routine below to move onto the next category by moving to the last document in a specified category, then using view.GetNextDocument to move to the next category. Call the routine below as follows:
notesBackendDoc = GoToLastDocInCategory(StartDoc, View, FieldName, CategoryValue)
StartDoc- a NotesDocument in the category that you want to start out the search from.
View- a NotesView that you will be searching.
FieldName- a String containing the name of the item that holds the Category value.
CategoryValue- a String containing what category value to check for.
Function GoToLastDocInCategory(StartDoc As NotesDocument, CheckView As
NotesView, ItemName As String, CategoryValue As String) As NotesDocument
Dim PreviousDoc As NotesDocument
Dim NextDoc As NotesDocument
Dim CategoryItem As NotesItem
Dim ThisDocCategoryValue As String
Set NextDoc = StartDoc
Set PreviousDoc = StartDoc
Set CategoryItem = StartDoc.GetFirstItem(ItemName)
ThisDocCategoryValue = CategoryItem.Text
Do While Not(NextDoc Is Nothing) And (CategoryValue = ThisDocCategoryValue)
Set PreviousDoc = NextDoc
Set NextDoc = CheckView.GetNextDocument(NextDoc)
If NextDoc Is Nothing Then Exit Do
Set CategoryItem = NextDoc.GetFirstItem(ItemName)
ThisDocCategoryValue = CategoryItem.Text
Loop
Set GoToLastDocInCategory = PreviousDoc
End Function