Let if be known that I'm not so proud I can't let a paying customer teach me how to do the job for them. Nor for one second do I think that I know all there is to know about Notes. What follows is a good case in point.
Remember the debate about how to design a university blogging tool from April? The solution we ended up using, which I'll discuss in more detail at some point soon, uses Readers fields. It soon became apparent that not only did the main blog entry need a Readers field, but each comment needed a readers field with the same values.
Inheriting the article's set of readers in to the child comment document at point of creation is trivial. It's keeping the values in all the comments inline with the parent when the values in the parent changes that's not so easy. It's at the point we try and mimic relational behaviour that code gets messy. Normally I'd opt for something like this in the WQS agent:
Dim comments As NotesDocumentCollection Dim comment as NotesDocument Dim readeritem as NotesItem Set comments = Web.Document.responses Set comment = comments.GetFirstDocument While not comment is nothing call comment.RemoveItem("DocReaders") set readeritem = New NotesItem(comment, "DocReaders", web.document.DocReaders, READERS) Call comment.Save(True, True) set comment = comments.GetNextDocument(comment) Wend
As I said though, the customer made this a whole lot easier for me by suggesting I look at using the StampAll method of the NotesDocumentCollection object. The above code thus becomes a single-liner:
Call Web.Document.Responses.StampAll("DocReaders", Web.Document.DocReaders)
This, to me at least, is a revelation. What about you? All this time with Notes and I've never once took the time to learn how to make use of the StampAll method, which I had heard of, but never used until last week. Something tells me I'll be using it a lot more in the future. Thanks Mark!
Is there anything I should know about the method? Is it as foolproof as it seems? What happens when you attempt multiple calls to StampAll on the same NotesDocumentCollection? Conflicts?