Examples: PostRecalc event

Each time the current document is recalculated, this script updates the contents of the address field. The document contains a keyword field called city, which is set to refresh the fields each time one of its keywords changes. Therefore, this script gets called any time the user changes the city field. The script modifies the contents of the address field, based on the contents of the city field.

Sub Postrecalc(Source As Notesuidocument)
  Dim location As String
  location = source.FieldGetText( "city" )
  Select Case location
  Case "Cambridge"
    Call source.FieldSetText( "address", "5 Memorial Drive" )
  Case "Chicago"
    Call source.FieldSetText( "address", "44 Diversey Blvd" )
  Case "Paris"
    Call source.FieldSetText( "address", "32 Rue Henri IV" )
  End Select
End Sub