17.06.2008 Henning Heinz  
Displaying Notes Doclinks in Views in the Notes Client

This is not from me but from Jerry Glover posted on notes.net. Normally there is no easy way to display Notes Doclinks in Client views. Well now there is. I admire people that are able to think around the corner.

The following recipe is a solution (or workaround depending on your point of view) to displaying a link icon in a view which, when clicked, opens a document in another database related to the one displayed in the current view. The solution takes advantage of the InViewEdit feature of Notes.

Assumptions:
- There is a field on the displayed documents containing a UNID for the related document to be displayed.
- Actual in-view editing is not required for the view.

First, create a column to display an icon for the link. Enter a formula for the column value as follows:

Icon := 41;
Icon

This value (41) represents the tan dog-eared page icon which is similar to the standard doclink icon. It's important to use the variable assignment rather than a numeric literal because the Editable Column option will be grayed out and unavailable if a literal is used.

Next, bring up column properties and select the checkboxes for "Display values as icons" and "Editable Column"
Finally, open the view's InViewEdit event and add the following LotusScript code and modify as necessary to open your target documents.

----------

Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim caret As String
Dim URLparts(4) As String

caret = Source.CaretNoteID
If caret = "0" Then Exit Sub 'check for click on a doc, not a category

Set db = Source.View.Parent
Set doc = db.GetDocumentByID(caret)

'build the url to the link target document
URLparts(0) = "Notes:/" 'Notes protocol for the URL
URLparts(1) = db.Server 'this assumes the target db is on the same server as the current db
URLparts(2) = "my/target/database.nsf" 'your db path goes here
URLparts(3) = "0" 'special view placeholder, don't change
URLparts(4) = doc.LinkUNID(0) 'replace with fieldname containing a UNID for the target doc

Call ws.URLOpen( Join( URLparts, "/") )

----------

Hope this helps,
-jerry
Yes, it does.
Thank you very much.
Doclinks in Views

Post a new comment