Examples: NumberAttrib property (NotesViewColumn - LotusScript®)

  1. This agent displays the number attributes for a column.
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim vc As NotesViewColumn
      Dim f As String
      Set db = session.CurrentDatabase
      Set view = db.GetView("View A")
      Set vc = view.Columns(1)
      If (vc.NumberAttrib And VC_ATTR_PARENS) = _
      VC_ATTR_PARENS Then
        msg1$ = "Parentheses on negative numbers"
      Else
        msg1$ = "No parentheses on negative numbers"
      End If
      If (vc.NumberAttrib And VC_ATTR_PUNCTUATED) = _
      VC_ATTR_PUNCTUATED Then
        msg2$ = "Punctuated at thousands"
      Else
        msg2$ = "Not punctuated at thousands"
      End If
      If (vc.NumberAttrib And VC_ATTR_PERCENT) = _
      VC_ATTR_PERCENT Then
        msg3$ = "Percentage"
      Else
        msg3$ = "Not a percentage"
      End If
      Messagebox msg1$ & Chr(13) & msg2$ & Chr(13) & msg3$,, _
      "Number attributes"
    End Sub
  2. This agent sets a column for parentheses on negative numbers, punctuation at thousands, and not to display as a percentage.
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim vc As NotesViewColumn
      Dim f As String
      Set db = session.CurrentDatabase
      Set view = db.GetView("View A")
      Set vc = view.Columns(1)
      vc.NumberAttrib = VC_ATTR_PARENS + VC_ATTR_PUNCTUATED
    End Sub
  3. This agent sets a column to display as a percentage without losing any other attributes that are set.
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim vc As NotesViewColumn
      Dim f As String
      Set db = session.CurrentDatabase
      Set view = db.GetView("View A")
      Set vc = view.Columns(1)
      vc.NumberAttrib = vc.NumberAttrib Or VC_ATTR_PERCENT
    End Sub
  4. To set a number attribute without disturbing the others, use a logical construct of the following form:
    vc. NumberAttrib = _
    vc. NumberAttrib Or VC_ATTR_PARENS

    To set two number attributes without disturbing the others, use a logical construct of the following form:

    vc.NumberAttrib = _
    vc.NumberAttrib Or VC_ATTR_PARENS Or VC_ATTR_PUNCTUATED

    To unset a number attribute without disturbing the others, use a logical construct of the following form:

    vc.NumberAttrib = _
    vc.NumberAttrib And (Not VC_ATTR_PARENS)

    To unset two number attributes without disturbing the others, use a logical construct of the following form:

    vc.NumberAttrib = _
    vc.NumberAttrib And (Not (VC_ATTR_PARENS Or VC_ATTR_PUNCTUATED))