도미노의 그룹웨어라는 특성상 전자결재등의 공문서에 많은 부분 집중된다. 집중되는 만큼 활용방법도 다양해야 하는게 바로 이부분이다보니 여러가지 필요한 성격이 있다. 공문서등의 업무적인 양식에는 빈칸이 존재하는 경우 안되는 그런 일이 있다. 그때 일반적인 필드(텍스트, 숫자, 날짜등)에서는 확인이 쉽지만 RTF(Rich Text Field : 리치텍스트필드)에서는 확인이 어렵다. 그럼에도 불구하고 사용자가 RTF를 사용하는 이유는 텍스트필드와 달리 글씨와 그림등을 붙여 넣어서 사용할 수 있다는 장점 때문이다.
이런 장점을 장점으로 활용하기 위해서는 RTF에 값이 있는지 없는지를 체크할 수 있어야 한다고 생각한다. 그래서 아래와 같은 코드를 이용하면 가능하다.
Function IsRTFNull(rtfield As String) As Integer
On Error Goto Errhandle
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
If currentfield <> "" Then
Call uidoc.GotoField(currentfield)
End If
IsRTFNull = False
Exit Function
Errhandle:
Select Case Err
Case 4407
If currentfield <> "" Then
Call uidoc.GotoField(currentfield)
End If
IsRTFNull = True
Exit Function
Case Else
Error Err
End Select
End Function
[설명이 포함된 채로 소개된 외국사이트의 글]
Function IsRTFNull(rtfield As String) As Integer
'This function tests a Rich Text field to see whether or not it is null. It returns TRUE if the field is null, and
'returns FALSE if the field is not null. It works even if the rich text field contains a file attachment,
'doclink, or OLE object but does not contain any text.
On Error Goto Errhandle
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
'Store the name of the field that currently has focus. Note: if this function is being called from a form button,
'currentfield will be null (because the button has the focus, and not a field). If this function is called
'from an action button, and if the cursor is in a field, then currentfield will correctly store the name
'of the field that has focus.
currentfield = uidoc.CurrentField
Call uidoc.GotoField(rtfield)
Call uidoc.SelectAll
'The next line will generate a 4407 error message if the Rich Text Field is null
Call uidoc.DeselectAll
'Return the cursor the the field that had focus before this function ran. If the currentfield variable is null (because a button
'or hotspot had focus, then the cursor will actually wind up getting left in the rich text field.
If currentfield <> "" Then
Call uidoc.GotoField(currentfield)
End If
IsRTFNull = False
Exit Function
Errhandle:
Select Case Err
Case 4407
'the DeselectAll line generated an error message, indicating that the rich text field does not contain anything
If currentfield <> "" Then
Call uidoc.GotoField(currentfield)
End If
IsRTFNull = True
Exit Function
Case Else
'For any other error, force the same error to cause LotusScript to do the error handling
Error Err
End Select
End Function