SNTT: a pseudo Computed for Display Rich Text Field in the Lotus Notes Client

As in last weeks posting, I wanted to have help verbiage centrally maintained (without developer innervation) but always displayed update in the end user document (the final end user). Easy enough to do with text or on the web, but doing this with rich text (pictures and text markup) on the Notes Client was non trivial. Rich Text field are either “editable” or “computed” which mean it wasn’t going to update it if the document was in read mode.

So what I created was a pseudo Computed for Display Rich Text Field.

the field itself was a straight forward Rich Text Computed field, named “RTCF_Help”, and with the lotus formula

@GetProfileField( “ApplicationProfileDocument” ; “HelpDocumentation”)

where “ApplicationProfileDocument” is the name on the Profile document and “HelpDocumentation” is the rich text field on that Profile document.

the trick is to destroy the item on the document so that even in read mode the field is recreated and re computed. I’m doing it before the document open and as it closes.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)

Dim doc As notesdocument
Set doc = Source.Document
Dim item As NotesItem

If Not Isnewdoc Then
Set item = doc.GetFirstItem("RTCF_Help")
If Not item Is Nothing Then
Call item.Remove()
End If
End If

' the rest of your code if any....

End Sub

Sub Queryclose(Source As Notesuidocument, Continue As Variant)

Dim doc As NotesDocument
Set doc = Source.Document
Dim item As NotesItem

Set item = doc.GetFirstItem("FMUniversalUpdaterHelpDoc")

Call item.Remove()

End Sub

One thing that didn’t work was any attached file in the profile documents rich text, which looked like it was there but would open / launch (which is where last weeks post came from : SNTT : using LotusScript to launch file attachements (EmbeddedObjects) in Lotus Notes).

The fall back position for this would be have a Button that opened the Profile document in read mode like this

1
2
3
4
5
6
7
8
9
10
11
Sub Click(Source As Button)

Dim  workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set doc = db.GetProfileDocument("ApplicationProfileDocument" )
Call workspace.EditDocument( False, doc, True )

End Sub

enjoy :)

I’ve add having a real Computed for Display Rich Text Field in the Lotus Notes Client to Idea Jam

4 thoughts on “SNTT: a pseudo Computed for Display Rich Text Field in the Lotus Notes Client

  1. Another idea for *your* usecase with help: add the help as html Code into a cfd field. But that would mean that you can’t use pictures (needs http task, which might not be available offline).

    Or a extra document for help, which is displayed in the different frame.

  2. Good approach, we did similar aproaches (destroying the richtext item), but your code is somewhat shorter.
    But I have very bad experiences with richtext fields within a profile document, especially with attachments within those fields. There seems to be a limitation, that you cannot have more than one (1) attachment within a profile document (I think there was an entry in the knowledge base or notes.net about that, too). If you add more than one, only one will survive – the others will be shown just a images of the attachment icon, but display an error when trying to access them. I suppose this is related to the profile document’s feature that it is going to be cached – so I think having LARGE profile docs will be a bad thing anyway.
    I have solved my headaches (after finding out about the attachment limitations the hard way) by moving richtext fields to be “looked up” into special template documents organized in a hidden view. This means some more coding, but gives you a lot more flexibility and less headaches…

    Hans-Peter

  3. I’ved created a button for Profile document in read mode, but when ever
    i click the button it displays this.

    Notes Error – Cannot locate Default Form

    What do i do? Please do help me. Thanks a bunch!

  4. I have this code for my button

    Sub Click(Source As Button)
    Dim workspace As New NotesUIWorkspace
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Set db = session.CurrentDatabase
    Set doc = db.GetProfileDocument(“PDR”)
    Call workspace.EditDocument( False , doc, True )

    End Sub

    PDR is my Profile Document, yes it opens in read mode,
    but not on the current document. What it does, it’s opening a new
    document in read mode, all fields are in read mode. the whole thing
    opens in read mode. I thought that the only thing would be in read
    mode is the rich text in the current document. Honestly this problem
    is driving me crazy as hell. Can anyone help me to solve this? Thanks!

Leave a Reply