Examples: Formula property (NotesViewColumn - LotusScript®)
- This agent displays whether the columns in a view are based on
fields or formulas, and displays the item name for fields and the
formula for formulas.
Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim view As NotesView Dim f As String Set db = session.CurrentDatabase Set view = db.GetView("View A") Forall vc In view.Columns title = vc.Title If title = "" Then title = "<No title>" If vc.IsField Then Messagebox "Column is based on field " & _ vc.ItemName,, _ "Column " & vc.Position & " - " & title Elseif vc.IsFormula Then Messagebox "Column is based on formula:" & Chr(13) & _ vc.Formula,, _ "Column " & vc.Position & " - " & title Else Messagebox "IsField and IsFormula are both False",, _ "Error" End If End Forall End Sub
- This agent toggles the formula 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(2) If Not vc.IsFormula Then Exit Sub If vc.Formula = "@Created" Then vc.Formula = "@Modified" vc.Title = "Modified" Else vc.Formula = "@Created" vc.Title = "Created" End If End Sub