Skip to main content
    Country/region select      Terms of use
     Home      Products      Services & solutions      Support & downloads      My account     

developerWorks  >  Lotus  >  Forums & community  >  Best Practice Makes Perfect

Best Practice Makes Perfect

A collaboration with Domino developers about how to do it and how to get it right in Domino

technological toysI'm in the process of reviewing more Designer help changes for version 8.0, and I'm finding out some useful new functions.

Note: you might be thinking, he's the project lead for Domino Designer and he's discovering things he didn't know about? How is that possible? Is he like Alberto Gonzales and doesn't know what's going on in his department? Actually, it's because the programming languages aren't considered part of Designer -- they're handled by a separate team, and I've been so busy with the the stuff I'm responsible for, that I haven't had much chance until now to see what they've been up to.

Here are a few of the more useful ones (note: all these in LotusScript are also available in Java):

  • GetAllReadDocuments and GetAllUnreadDocuments methods of NotesDatabase, MarkRead and MarkUnread methods of NotesDocument. No longer need to make C API calls to mark documents read, hooray! There are similar methods in other classes.
  • Clone, Intersect, Subtract, Contains and Merge methods of NotesDocumentCollection give more options for combining sets of documents to conduct relational-like searches in your code.
  • CopySelectedAsTable @Command, does what it sounds like.
  • NotesDatabase.GetProfileDocCollection, the Profilename argument is now optional, which lets you get all the profile documents in the database. Formerly, I believe you could do this with a NotesNoteCollection, but this way is a little easier.
  • NotesDXLExporter has a bunch of new options to control the output, including such things as converting all images to GIF (which is useful for other applications, unlike the Notes proprietary image format), asking for only specific fields (items), and leaving out pictures, file attachments and OLE objects (which can be a big performance boost if your application doesn't require them).
  • The new NotesDirectory and NotesDirectoryNavigator classes support rapid searches in the Domino Directory, for users and groups.

Andre Guirard | 23 April 2007 09:14:01 PM ET | Café Porch, Plymouth, MN, USA | Comments (10)


Nathan T. Freeman | 4/24/2007 11:57:52 AM

"GetAllReadDocuments and GetAllUnreadDocuments methods"

'nuff said.

2) How about a UIDoc property to let us know if the doc has changed?
Benoit Dubuc | 4/24/2007 12:48:04 PM

I've been asking this for a while... In MS Access, there is a property called "dirty" that let developers know if the form has been updated or not (data changed). Notes most definitely has that feature, as it prompts us for saving our changes when closing a document.

Would it be possible to make that property available in the NotesUIDocument? And while we're at it, can that property be read-write, so if we have a QueryOpen agent that adds some values for a dialog list, let's say, we can reset this property so there is no unnecessary prompt when closing the document without having changed a thing?

Thanks and keep up the good work!

3) oooh! shiny!
Charles E. Robinson | 4/24/2007 1:53:12 PM

The NotesDocumentCollection enhancements are very, very welcome. Can we create a standalone empty NDC without resorting to lame hacks? :-)

I second Benoit's plea for some kind of dirty flag on a document, or even just NotesUIDocument. Maybe that's better suited as fodder for harassing Bob Balaban.

4) re: oooh! shiny!
Andre Guirard | 4/24/2007 4:00:48 PM

> Can we create a standalone empty NDC without resorting to lame hacks?

Regrettably, no. The best way I can think of is:


Function CreateEmptyCollection(db As NotesDatabase) As NotesDocumentCollection

Dim dtCutoff As New NotesDateTime("")


dtCutoff.AdjustYear 1 ' just to make extra sure we don't have to look at any documents in the search

Set CreateEmptyCollection = db.Search("@False", dtCutoff, 1)

End Function


It's a hack, but at least it's reasonably efficient. I'm entering a request for this ability.

>I second Benoit's plea for some kind of dirty flag on a document, or even just NotesUIDocument.

That does sound useful, and I'll enter it as a feature request. It would be more likely to occur if we could have some use cases for it, both for read and write.

Note: As I recall, operations in the Postopen event and earlier don't set the dirty flag (or more precisely, it's cleared after Postopen), so the use case Benoit gives for being able to write this flag isn't valid.

5) I’ll give that a try
Benoit Dubuc | 4/24/2007 10:25:06 PM

Andre, I have that exact situation in my current project: I need to pre-populate some fields on the PostOpen event.

I was sure that doing this was causing the prompt to appear even if there was no other value changed by the user. I haven't used that in a while though (may go back to R4 days).

Funny how after ten years we learn new things about Notes...

6) NotesUIDocument.ModifiedSinceSaved
Julie Peck | 4/25/2007 8:35:09 AM

There is an undocumented property of the NotesUIDocument class that indicates whether the UI document has changed since it was last saved (which I think is what people are asking for in the "dirty" property:


I think the last time I used it would have been in R6.5.x so I don't know whether it works in later releases or not.


7) ModifiedSinceSaved isn’t quite robust enough...
Charles Robinson | 4/25/2007 9:56:16 AM

My memory is a little fuzzy, but when I tried using ModifiedSinceSaved it was only useful for documents that have already been saved. Here's a technote on it: { Link }

Andre, where should we direct our use cases?

8) re: ModifiedSinceSaved isn’t quite robust enough...
Andre Guirard | 4/25/2007 11:03:27 AM

> Andre, where should we direct our use cases?

Here is good. I do intend this blog to be a discussion -- and if you post your use cases, others might suggest alternative ways to do what you want, which saves me work. :-)

9) Cool stuff
Ben Dubuc | 4/25/2007 5:38:21 PM

That property is indeed what I was looking for. I also tried adding some values to fields in the post open event and it works like Andre said it would: if nothing else is changed once the postopen code has run, Notes will not prompt to save the document.

Amazing how after 10 years we still learn new things.

Great info, guys. Thanks a lot

10) I’ll put on my thinking cap
Charles Robinson | 4/27/2007 8:05:31 AM

I've flipped my head around to think in terms of PostOpen or a combination of NotesItem lists and SaveOptions, so I'll have to dig back into why I wanted this in the first place.

 Add a Comment
Comment:  (No HTML - Links will be converted if prefixed http://)
Remember Me?     Cancel

Search this blog 


    About IBM Privacy Contact