Programmatically Update View Selection Formula

Mindwatering Incorporated

Author: Tripp W Black

Created: 03/05/2010 at 05:42 PM


Notes Developer Tips
LotusScript, Views

Example of an agent to update a view's selection that includes a year.

Dim s As New NotesSession
Dim db As NotesDatabase ' current db
Dim sV As NotesView ' view to modify
Dim yrthis as Integer ' this year
Dim selstr As String ' selection string for view

' setup environment
Set db = s.Currentdatabase
Set nowNDT = New NotesDateTime(Now)
Set sV = db.Getview("webFrmCur") ' gets the view by alias/name
yrthis = Year(Now)

' update the view selection
selstr = {SELECT Form="MyForm" & DocYear= "} & Cstr(yrthis) & {"}
sV.SelectionFormula = selstr

' refresh view
Call sV.Refresh()

previous page