Search DominoPower's 11,443 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.
Troubles with views (continued)

Now, when we get the first child document, in the statement:

set child = view.GetChild(maindoc)

Notes uses the parameter (maindoc) as a positioning value to denote which document to get the child of. However, it doesn't appear to use the document's UNID or NoteID, but instead, some internal handle to the document's position in the view. So when the ParentView value of the document is not the "defaultView" that we use for the GetChild statement, the pointer or position value passed as the document handle doesn't mean anything, and Notes passes back the 4151 error, the document is not in the view. And of course, when the agent is started from the default view, it then works fine.

While we're talking about views in LotusScript, let me mention a couple of other tips.

This first one I got from a session at Lotusphere a year or two back. It's always said that you should give views an alias name so that should you decide that the name seen by end-users needs to be changed, any programmatic access won't be disrupted if the code always uses the alias name.

But when Notes is searching for a view to satisfy with a NotesDatabase.GetView operation, it actually searches the list of views in the database alphabetically, from top to bottom, case sensitive, using the view's main name. If there is no match, it traverses the main names again, case-insensitively. Only then does it check the alias name list, first case sensitively, then case-insensitive. So if you do the right thing and use a view alias name, but get the case wrong, Notes will search the list of view four times to find it.

The corollary of that is that for maximum performance, you should always search for a view by its main name, and be sure that you get the case right in the GetView operation. I'd suggest that this is a good reason for leaving views seen by end users to be seen only by end users, and don't give them an alias at all, so then they don't get searched by a GetView looking at aliases.

For views used programmatically, make them hidden from the end-users by using a name in parentheses, and then be sure to spell the name in the correct case.

The other tip is to do with programmatic use of sort-on-the-fly views. If these views are used programmatically on the server, all will be fine. But when used on a client, the view will appear to the code to be sorted in the order that the end-user last sorted the view, which means that operations such as GetDocumentByKey will deliver strange results, and the order in which documents are delivered to the code might also be not quite as expected.

Steve Niles is Senior Editor for ZATZ Publishing. He is also an independent filmmaker and freelance writer. For more information, visit http://www.sn-films.com.


« 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
Home > Tips & Techniques (102 articles)
   More about Domino log files
   Why your log.nsf might not be purging properly
   A faster way to repair corrupted server files
Home > Lotus Technologies > Application Development (48 articles)
   An application for scanning physical mail and distributing it virtually
   How hide-whens in Rich Text can ruin your whole day (and what to do about it)
   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
Syncing Notes with Android phones
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
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: Online safety for virtual learning
David Gewirtz Online: CNN commentary and analysis
OutlookPower: Seek and find: Strategies to locate filed-away emails fast
-- Advertisement --

Find unused Lotus Notes groups and clean up your address book
Have you ever wanted to get rid of old Lotus Notes groups that were cluttering up your address book, but you weren't sure if they were used? Find Unused Groups can help.

Find Unused Groups will check your ACL, mail, multi purpose and server groups to help you determine if they are used, and who uses them.

Learn how to easily clean up your address book.

-- 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