Examples: Categorize method

This form action script saves, categorizes, and closes the current document without displaying any dialog boxes to the user. The document is categorized based on the contents of its Rating field. If the rating field is empty, the script saves and closes the document, but does not categorize it. (The action is displayed only while the document is in Edit mode.)

Sub Click(Source As Button)
  Dim workspace As New NotesUIWorkspace
  Dim uidoc As NotesUIDocument
  Dim r As String
  Set uidoc = workspace.CurrentDocument
  Call uidoc.Save
  r = uidoc.FieldGetText( "Rating" )
  Select Case r
  Case "Good":
    Call uidoc.Categorize( "Successful Projects" )
  Case "Bad":
    Call uidoc.Categorize( "Unsuccessful Projects" )
  Case "Mediocre":
    Call uidoc.Categorize( "Mediocre Projects" )
  End Select
  Call uidoc.Close
End Sub