Search DominoPower's 11,441 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
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: 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 --

Integrate your Notes Applications with Microsoft Office and Symphony
Integra for Notes Integrates Microsoft Office and/or IBM Lotus Symphony
Requires NO change to the design of the appliation or Installations of DLL's and EXE's
  • Integra is a ready to use solution, enhance static reports with Excel data analysis, pivot tables, macros
  • User friendly aproach, using a point and click access to features
  • Reports from any Lotus Notes databases
  • Runs reports through a Notes client, web browser and scheduled basis
  • Allows use of LotusScript for advanced data manipulation
  • Enables self service reporting capabilities to end-users


Learn more at www.integra4notes.com.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login