The problem is very simple: I want to hide a Rich Text field (RTF) if it is empty and show it if it has something in it, in my case one or more attachments. In Lotus Notes a Rich Text Field will not evaluate to empty even if it is emtpy so using a common Hide-When forumula such as MyRTF=”" will not work and you can only use @Formulas.
1) Create a new Numeric field, Computed for Display, Hidden, and with Value set to @ThisValue (or HideMyRTF if you are using an earlier release than ND6) Lets call this field HideMyRTF in this example.
2) Set the Hide-When formula of your existing Rich Text Field – lets call it MyRTF in this example – simply to HideMyRTF (meaning if HideMyRTF is True then hide MyRTF)
Dim rtitem As NotesRichTextItem Set rtitem = source.Document.GetFirstItem( "MyRTF" ) If Isempty(rtitem.EmbeddedObjects) And Trim(rtitem.Text) = "" Then source.Document.HideMyRTF = 1 Else source.Document.HideMyRTF = 0 End If
It was a long time since I did any Lotus Notes development so I’m a bit rusty. I’m sure I’ve come up with this or a similar solution in the past but I could not find any when searching so I had to start from the beginning.
This was for an existing app that has been around for quite a few years so there is no way for me to control anything from the beginning. I guess I could have used an agent to set some stuff but this would most likely cause tons of replication conflicts as there are tens of thousands of documents, still being updated by users and replicated across several servers.
Done with a Lotus Notes 7.02 client (I told you it’s been a while…) but should work on older and newer releases.