Search DominoPower's 11,422 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
New Release 5.0 classes: NotesViewEntryCollection and NotesViewEntry (continued)

Getting the number of category entries in a view
The next example returns the number of category entries in a view.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim vecoll As NotesViewEntryCollection
Dim entry As NotesViewEntry
Dim c As Integer
Set db = session.CurrentDatabase
Set view = db.GetView("viewName")
Set vecoll = view.AllEntries
Set entry = vecoll.GetFirstEntry
c = 0
While Not (entry Is Nothing)
If (entry.IsCategory) Then
c = c + 1
End If
Set entry = vecoll.GetNextEntry(entry)
Wend
MsgBox "The number of categories in the " & view.Name & " is " & Cstr(c)

Building an array of documents in a view
As we move on in our code examples, this next one shows you how you can build a routine that scrolls through all entries in a view, and assembles an array of all documents found in the view. A message box displays the number of documents found in the view.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim vecoll As NotesViewEntryCollection
Dim entry As NotesViewEntry
Dim docArray()
Set db = session.CurrentDatabase
Set view = db.GetView("Test")
Set vecoll = view.AllEntries
Set entry = vecoll.GetFirstEntry
Redim docArray(0)
While Not (entry Is Nothing)
If (entry.IsDocument) Then
Set docArray(Ubound(docArray)) = entry.Document
Redim Preserve docArray(Ubound(docArray) + 1)
End If
Set entry = vecoll.GetNextEntry(entry)
Wend
Msgbox "Number of documents found in view: " & Cstr(Ubound(docArray) - 1)

NotesViewEntry and NotesViewEntryCollection in the Object Browser
The NotesViewEntry and NotesViewEntryCollection contain numerous methods and properties, as you can see in Figure A. The Object Browser can be used to view all of them.

FIGURE A


You can tinker with all the methods and properties of NotesViewEntry and NotesViewEntryCollection using the spiffy new Release 5.0 Object Browser. Roll over picture for a larger image.

Conclusion
Using the NotesViewEntry and NotesViewEntryCollection classes is just like using a NotesDocumentCollection, but the new classes allow you to get more information regarding entries in a view. You can now retrieve category or total entries and determine such characteristics as whether a document has been read or not.

Next month we will continue our travels through Domino 5.0 with more LotusScript goodies.

David Gewirtz is the author of How To Save Jobs and Where Have All The Emails Gone? For more than 20 years, he has analyzed current, historical, and emerging issues relating to technology, competitiveness, and policy. David is the Editor-in-Chief of the ZATZ magazines, is the Cyberterrorism Advisor for the International Association for Counterterrorism and Security Professionals, and is a member of the instructional faculty at the University of California, Berkeley extension. He can be reached at david@zatz.com and you can follow him at http://www.twitter.com/DavidGewirtz.


« Previous  ·  1  ·  2
Other articles you might like
Home > Lotus Technologies > LotusScript (64 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Little known traps about Lotus Notes fields
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
New Notes/Domino Technotes published about Chile's extended daylight saving time
SnnT: How to prevent Google from listing your Sametime Server
How to send someone an email that shows your calendar availability
"The collection has become invalid"
More XPages onclick event weirdness...
Domino 8.5.1 Fix Pack 1 Interim Fix 1 (8.5.1 FP1 IF1) - DAOS Fixes
Domino Designer 8.5 Tip: Where Working Sets Are Stored
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done. Native to Lotus Domino. The User Experience unseen for Lotus Domino. Do more with less. Really.

See the possibilities Docova unleashes for Lotus Domino.
-- Advertisement --

Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.

Register by April 10 to save $200.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login