February 23, 2006


Show n Tell Thursday
Posted by Don McNally in Guest Bloggers

Here's my first contribution to this new web-wide feature. It took me a while to come up with something small that I thought may be useful. This is a kinda sorta pseudo-relational behavior you can incorporate into a view.

Say you have a set of response documents that contain the fields you want to display in a view. But, instead of opening those documents when they are clicked, you would rather open their parent document. And you display the response documents in other views, but in those views you want to open the response document (so you don't want to put code in the QueryOpen of the response form). What do you do?

Put this code in the QueryOpenDocument event of the view and the parent document will open instead of the document that you double-clicked to open.

UPDATE: I added some error handling for orphans, unreadable parents and replication conflicts. Don't know why I didn't think of it, other than that we hadn't run into those problems in the view where I used the code.
Sub Queryopendocument(Source As Notesuiview, Continue As Variant) Dim doc As NotesDocument Dim docParent As NotesDocument Dim ws As New NotesUIWorkspace Dim openIt As Integer openIt = False Set doc = Source.Documents.GetFirstDocument If doc.IsResponse Then Continue = False If doc.HasItem("$Conflict") Then Messagebox "Opening replication conflicts is not allowed in this view",48,"Open Document" Exit Sub End If Set docParent = doc.ParentDatabase.GetDocumentByUNID(doc.ParentDocumentUNID) If docParent Is Nothing Then openIt = False Elseif docParent.IsDeleted Or Not docParent.IsValid Then openIt = False Else openIt = True End If If openIt Then Call ws.EditDocument(False,docParent) Else Messagebox "Cannot open requested document. This may be because " &_ "the selected document is an orphan or because " &_ "you do not have access to the requested document.",48,"Open Document" Exit Sub End If End If End Sub
This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.
Permalink

Comments

dude! i'm not sure what your code does yet, but your eexplanation of it just turned my socks inside out! that was a neat trick, how did you do that?

Posted by: jonvon at February 23, 2006 06:01 PM
Post a comment









Remember personal info?




In order to combat spam, you must preview first and THEN submit.


c++
forums
lotus notes
misc & links
picture gallery
internet how-to articles


about jess

ICQ 822906
AIM kendrtaunt
YIM kender_taunt

xmlbutton.gif