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

This entry was posted in Code, Lotus Domino, Show-n-Tell+Thursday. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. Posted September 3, 2009 at 8:40 am | Permalink

    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. Posted September 4, 2009 at 10:39 am | Permalink

    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

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*
  • Follow

  • Archives (since 2003)

  • Categories

  • Recent Posts

  • Twitter Updates

    Error: Twitter did not respond. Please wait a few minutes and refresh this page.

  • del.icio.us links

  • Flickr

    Runnymede Healthcare Centre Demolition : The EndRunnymede Healthcare Centre Demolition : The EndRunnymede Healthcare Centre Demolition : The EndRunnymede Healthcare Centre Demolition
  •  

    September 2009
    M T W T F S S
    « Aug   Oct »
     123456
    78910111213
    14151617181920
    21222324252627
    282930  
  • Spam Blocked