Manage Learn to apply best practices and optimize your operations.

Check Rtf Field Empty ( New One Which Works)

This function checks if a rich text field is empty.. there was one which was
posted earlier that checked if RTf.Valuelength is less than 96
but it did not work .. so a new code emerged!
Function IsrtfMT (doc As Notesdocument , FieldName As String) As Integer
' This function checks if a rich text field is empty

Dim mbdcount As Integer,plaintext As String
Dim rtitem As Variant
mbdcount =0 ' initialize
Set rtitem = doc.GetFirstItem(fieldname)
If ( rtitem.Type = RICHTEXT ) Then
plainText = rtitem.GetFormattedText( False, 0 ) ' render the
Rich item into text this gets all text values and ignores attachments/OLE
If Len(plaintext) < 1 Then

If Isarray(rtitem.EmbeddedObjects) Then
Forall o In rtitem.EmbeddedObjects ' loop through
array of embedded objects in the rich text item
mbdcount=mbdcount+1 ' there is at least
one emb object
End Forall
End If
End If
End If

If (mbdcount + Len(plaintext)) < 1 Then ' if there are no embedded
objects AND there is no text also
IsrtfMT=1 ' return flag to calling string RTF IS EMPTY
Else
IsrtfMT=0 ' return flag to calling string RTF IS NOT EMPTY
End If





End Function

Dig Deeper on Domino Resources - Part 3

SearchWindowsServer
Search400
  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

SearchDataCenter
SearchContentManagement
Close