Home > Domino Tips > Developer > Formula > Hide when formulas for rich text fields
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

FORMULA

Hide when formulas for rich text fields


Pantelis Botsas
08.19.2002
Rating: -3.12- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Once you have created a RichTextField on a form and if you have assigned a Hide-When-Formula to it, then every document gets this Hide-When-Formula as a "fix"-property on this RichTextField.

Lotus tells us here, that this works as it should be. Nevertheless sometimes I have wasted time on this "feature" because the formula have changed during the application running time. The information in the RichTextFields couldn't be displayed with the new formula.

Create an agent which scans all the relevant documents. This agent extracts the text of the desired RichTextField(s) on the document, deletes the Field and recreates it. Finally the extracted text is written into the "new" field.

Also for included attachments this way can help to have access on the files. Here you have to use the GetEmbeddedObject()-Method of the RichTextField, extract the files on disk and re-attach them on the "new" field.

There are restrictions on the functionality with the code published below. Pictures or documents which have been created as objects in the RichTextField can't be restored. Formatted Text with colors and different shapes or fonts will lose it's attributes and will be restored as plain text. But sometimes this one is better than telling your users or customers that they will have to re-type everything.

And: if someone can expand the functionality of this code, so that there aren't any restrictions - go on and publish it on this site.

Here's the code for the Agent. The code is designed to regain access only for the text inside a RichTextField



Code

(Options)
Option Public

(Declarations)
Dim s As NotesSession
Dim db As NotesDatabase
Dim col As NotesDocumentCollection
Dim doc As NotesDocument
Dim rtf As NotesRichTextItem
Dim rts As NotesRichTextStyle

Sub Initialize()
 Dim Search As String
 Dim rtfText As String
 Dim fldList As Variant
 
 Set s = New NotesSession
 Set db = s.CurrentDatabase
 
 Search = |SELECT Form="frmFormName"|
 
 Set col = db.Search(Search, Nothing, 0)
 
 If col.Count>0 Then
  fldList = Evaluate(|"rtfField1":"rtfField2"|)
  
  Call SetRTS()
  
 Set doc = col.GetFirstDocument()
 While Not(doc Is Nothing)
  Forall f In fldList
   Set rtf = doc.GetFirstItem(f)
   rtfText = rtf.GetFormattedText(False, 0) 'extract text
   ' >> Here goes the code for extracting attachments <<
   Call doc.RemoveItem(f)
   Set rtf = New NotesRichTextItem(doc, f)
   Call rtf.AppendStyle(rts)
   Call rtf.AppendText(rtfText)
   ' >> Here goes the code for re-attaching the files >>
   Call doc.Save(Treu, False, False)
  End Forall
  Set doc = col.GetNextDocument(doc)
  
        Wend
 End If
End Sub

Sub SetRTS()
 Set rts = s.CreateRichTextStyle
 rts.Bold = False
 rts.Italic= False
 rts.FontSize = 9
 rts.NotesColor = 0 'black
End Sub

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Formula
View hidden fields on Lotus Notes/Domino forms
Case-insensitive @Unique version combines fields on Lotus Notes forms
Provide rich-text formatting via the Profile document and Formula
Using Formula language code to sort Lotus Notes messages by subject
How to create dynamic JavaScript in Notes Domino without formulas
Formula language button manages Deny Access list searches
Retrieve Lotus Notes names from a nested group using @DBLookup
Create a computed Lotus Notes field to list Personal Address Book names
Show multiple Lotus Notes document fields in a single view column
How to send a document as a link in a Lotus Notes email

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts