Manage Learn to apply best practices and optimize your operations.

Searching in a Rich Text Field

Notes by default does not have any in-built/native function or property which can search a Rich Text Field content.

Notes by default does not have any in-built/native function or property which can search a Rich Text Field content. I happenned to face this problem in one of my projects. Please try "GetDesiredContent" function given below. This function searches for the first word containing "*" in Body field of the given document. You may manipulate the given function to meet your requirement.

NOTE: I used array of all items in source document to get "Body" item. This is useful when notes is having multiple "Body" fields e.g. in mail document.


Function GetDesiredContent(sourceDoc As NotesDocument) 

'Get Body field from list of fields 
     Forall x In sourceDoc.items 
          If x.Name="Body" Then 
               Set bodyItem=x 
               Exit Forall 
          End If 
     End Forall 

'Get handle to Body field 
     bodyContent=Trim(bodyItem.Text) 

formatContent: 

'Search for first occurrance of '*' 
     pos=Instr(bodyContent,"*") 

If pos>0 Then 
          pos1=Instr(pos,bodyContent," ") 
          tempString=Left(bodyContent,pos1-1) 

'Start trimming to extract "*" containing word 
          Do While True 
               pos1=Instr(tempString," ") 
               If pos1=0 Then 
                    Exit Do 
               End If 
               length=Len(tempString) 
               tempString=Trim(Right(tempString,length-pos1)) 
          Loop 
     End If 

'Convert resultant content to text 
     formattedText=Evaluate("@Text("""+tempString+""")") 

'If formatted content contains blank spaces then reprocess it 
     If Instr(formattedText(0)," ")>0 Then 
          bodyContent=formattedText(0) 
          Goto formatContent 
     End If 

'Return the final formatted content containing "*" 
     GetDesiredContent=tempString 

End Function

Dig Deeper on Domino Resources - Part 7

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close