Email:   
Home
In This Issue
EasyPrint
Click here for the RSS feed's XML code. This is not a browser URL.
PROGRAMMING POWER
New Release 5.0 classes: NotesViewEntryCollection and NotesViewEntry
By Tony Patton

This month we continue the coverage of LotusScript enhancements in Domino 5.0. We focus on two new classes: NotesViewEntryCollection and NotesViewEntry. These classes allow you to work with individual elements in a view.

Using the NotesView class in Notes 4.x
In Notes 4.x, the NotesView class could be used to access documents in a view. The example below demonstrates using it to scroll through all documents in a view.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim view As NotesView
Set db = session.CurrentDatabase
Set view = db.GetView("viewName")
Set doc = view.GetFirstDocumetn
While Not (doc Is Nothing)
... code to work with document ...
Set doc = view.GetNextDocument(doc)
Wend

The NotesView class works well, but it only allows you to access documents in a view. In addition to documents, a view can contain categories and totals.

Using the Release 5.0 NotesViewCollection class
This is where the NotesViewCollection class comes into play. It lets you access all elements in a view, and it can tell you various characteristics of each element.

The next example demonstrates putting the NotesViewEntryCollection class to use.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim vecoll As NotesViewEntryCollection
Dim entry As NotesViewEntry
Set db = session.CurrentDatabase
Set view = db.GetView("viewName")
Set vecoll = view.AllEntries
Set entry = vecoll.GetFirstEntry
While Not (entry Is Nothing)
... code to work with view entry object...
Set entry = vecoll.GetNextEntry(entry)
Wend

As you can see, the NotesViewEntryCollection works the same as a NotesDocumentCollection. You set the NotesViewEntryCollection using the AllEntries property of the NotesView object. Once the object is set, you can scroll through all entries using the GetFirstEntry and GetNextEntry properties of the NotesViewEntryCollection object. These methods return a NotesViewEntry object.

Using the NotesViewEntry class
The NotesViewEntry class contains numerous properties and methods that signal the characteristics of the entry.

Table A below shows the properties that exist for NotesViewEntry objects.

Property Description
ChildCount Contains the number of children in the entry.
DescendantCount Contains the number of entries under the current entry.
IndentLevel Contains the number of levels the current entry is indented.
IsCategory Signals true or false whether the entry is a category or not.
IsDocument Signals true or false whether the entry is a NotesDocument object or not.
IsTotals Signals true or false whether the current entry contains totals or not.
SiblingCount Contains the number of entries at the same level of the current entry.
Document Contains the NotesDocument object of an entry, if it is a NotesDocument.





[ Next ]

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
-- Advertisement --

Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.

The many included activities and demos will make you a pro! Expert instructor help is a click away.

Click here to try a FREE demo course!!

-- Advertisement --

The Ultimate Notes Domino Training Experience - Amsterdam, 11-13 November
Get in-depth technical training that you can put to use on the job right away at THE VIEW's Admin2008 and Lotus Developer2008 Europe! One registration gets you into your choice of over 70 new and updated expert know-how sessions, one-on-one consultations, hands-on labs, and more.

See complete agendas and register by 10 October to save 495 euros!
Copyright © 1998-2008, ZATZ Publishing. All rights reserved worldwide.
Editor's Login