Search DominoPower's 11,425 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.
PROGRAMMING POWER
Troubles with views
By Mick Moignard

Here's a short piece with some tips on using Notes views programmatically from LotusScript. And it may be a first for DominoPower: it was written entirely with the Notes 8 document editor.

We had an interesting error come up in one of our project's agents last week, one that took us a little while to work out what the cause was. The agent is one that's run by hand from the Actions menu, and is intended to operate on the document under the highlight bar in the view that's open. That's usually one of a number of views that shows main documents and some of the responses to them. Sadly, this isn't the only problem report against this agent, but it was one that vexed us for a couple of hours while we tried to work it out.

The problem was this: when it was run against the default view, it worked just fine. Being the default view, that's how it was usually run. But if it was run against one of the other views, it failed with a 4151 error -- NOTES_DOC_NOTINVIEW, when to all appearances, the document in question was in the view -- because, of course, it was the one highlighted.

You can imagine that we puzzled on this for a while. Here's a simplified version of the code that shows the gist of it:

dim sess as new NotesSession
dim db as NotesDatabase
dim unProcesseddocs as NotesDocumentCollection
dim view as Notesview
dim maindoc as NotesDocument
dim child as NotesDocument

set db = sess.CurrentDatabase
set view = db.GetView("defaultView")
set unProcesseddocs = db.GetUnprocessedDocuments
set maindoc = docs.GetFirstDocument

set child = view.GetChild(maindoc)

It was on that last getChild statement that the failure occurred, when we started from a view that was not the default view. We read the help documentation about getChild. We ran the code in the debugger. We could see that maindoc has been instantiated. We could see maindoc in the view we started from -- obviously, because we started from it. We could also see it in the default view. And we checked that by UNID to be absolutely sure.

It became clear that the problem had to be how "maindoc" was identified when passed to view.GetChild, and as we explored with the debugger, we started to understand the problem.

When you get a document from the db.UnprocessedDocuments collection, it comes with the ParentView property set to the view that was displayed when the agent was started -- which, by the way, is contrary to what the help says. It says "If the document was retrieved directly from a database or a document collection, the ParentView property returns Nothing."


1  ·  2  ·  Next »
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
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
Quickr place Superusers
Writing Client-Side Javascript for Re-Use
Lotus Notes R8.5.1: Bug in Contacts "Print Selected View"
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"
>> 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 --

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