Manage Learn to apply best practices and optimize your operations.

Change view design or scheduled agent runtimes

This LSX lets you use LotusScript to set a parameter doc (NotesDocument) with view criteria (formulas, settings, columns, etc) and then build it.

View member feedback to this tip.

I wrote this LSX so developers could use LotusScript to set a parameter doc (NotesDocument) with view criteria (formulas, settings, columns, etc) and then build it. If the view exists, it modifies it; otherwise, it creates it. It also includes an agent class you can use to modify agent schedules from LotusScript. After you install the LSX, you'll need to restart the Notes client(s) for the LSX to properly register.

To do this without this LSX, you would need knowledge of the C or C++ APIs.

Code: Download here.

Examples
-------------
Customizing view note:
Dim view as CView
Dim s as New NotesSession
Dim db as New NotesDatabase("", "")
Dim doc as NotesDocument

Call db.open("Your server", "tbnlsxtest.nsf")
 ' Use your own database
Set doc = New NotesDocument(db)

doc.Form = "ParmDoc"
doc.ViewName = "MyTestView" '
 This is the only necessary parm. Defaults will be
used for all other parms that do not exist.
'doc.ViewSelection = {SELECT Form = "MyForm"}
doc.AltRowColorR = 192 ' 1..255
doc.AltRowColorG = 192 ' 1..255
doc.AltRowColorB = 255 ' 1..255
doc.BGColorR = 222 ' 1..255
doc.BGColorG = 226 ' 1..255
doc.BGColorB = 226 ' 1..255
doc.Alias = "MyAlias"
doc.Comment = "My test view..."
'...
doc.Save False, True, True ' you need to 
save the parm doc in the database 
where you want the view to be made.

Set view = New CView(doc)
Call view.BuildView()

doc.Remove True 

Customizing a scheduled agent's run time:
Option Public
Option Declare

%REM
// PARM DOC FIELDS
#define FIELD_AGENTNAME "AgentName"
#define FIELD_ASSISTSEARCH "AssistSearch"
#define FIELD_ASSISTTRIGGER "AssistTrigger"
#define FIELD_COMMENT "Comment"
#define FIELD_ENDHOUR "EndHour"
#define FIELD_ENDMINUTE "EndMinute"
#define FIELD_INTERVAL "Interval"
#define FIELD_INTERVALTYPE "IntervalType"
#define FIELD_ISENABLED "IsEnabled"
#define FIELD_ISHIDDEN "IsHidden"
#define FIELD_ISNEWCOPY "IsNewCopy"
#define FIELD_ISPRIVATE "IsPrivate"
#define FIELD_ODSFLAGS "ODSFlags"
#define FIELD_RUNONSERVER "RunOnServer"
#define FIELD_STARTHOUR "StartHour"
#define FIELD_STARTMINUTE "StartMinute"
%END REM

'Uselsx "C:lsxbinw32chrysalis.dll"
Uselsx "*Chrysalis"
Const ASSISTODS_FLAG_HIDDEN&     
 = &h00000001
 '/* TRUE if manual assistant is hidden */
Const ASSISTODS_FLAG_NOWEEKENDS&   
 = &h00000002 '/*
 Do not run on weekends */
Const ASSISTODS_FLAG_STOREHIGHLIGHTS&  
 = &h00000004 '/*
                TRUE if storing highlights */
Const ASSISTODS_FLAG_MAILANDPASTE&   
 = &h00000008 '/*
                TRUE if this is the V3-style mail and 
paste macro */
Const ASSISTODS_FLAG_CHOOSEWHENENABLED&
  = &h00000010 '/* 
                TRUE if server to run on should be 
chosed when enabled */

Const ASSISTTRIGGER_TYPE_NONE%    = 0 '/* 
     Unknown or unavailable */
Const ASSISTTRIGGER_TYPE_SCHEDULED%   = 1 '/*
     According to time schedule */
Const ASSISTTRIGGER_TYPE_NEWMAIL%   = 2 '/* 
     When new mail delivered */
Const ASSISTTRIGGER_TYPE_PASTED%    = 3 '/*
     When documents pasted into database */
Const ASSISTTRIGGER_TYPE_MANUAL%      = 4 '/*
     Manually executed */
Const ASSISTTRIGGER_TYPE_DOCUPDATE%   = 5 '/* 
     When doc is updated */
Const ASSISTTRIGGER_TYPE_SYNCHNEWMAIL%  
= 6 '/* 
     Synchronous new mail agent executed by router */

Const ASSISTSEARCH_TYPE_NONE%     = 0 '/*
     Unknown or unavailable */
Const ASSISTSEARCH_TYPE_ALL%     = 1 '/*
     All documents in database */
Const ASSISTSEARCH_TYPE_NEW%     = 2 '/*
     New documents since last run */
Const ASSISTSEARCH_TYPE_MODIFIED%   = 3 '/* 
    New or modified docs since last run */
Const ASSISTSEARCH_TYPE_SELECTED%   = 4 '/*
    Selected documents */
Const ASSISTSEARCH_TYPE_VIEW%       = 5 '/* 
    All documents in view */
Const ASSISTSEARCH_TYPE_UNREAD%    = 6 '/* 
   All unread documents */
Const ASSISTSEARCH_TYPE_PROMPT%    = 7 '/* 
   Prompt user */
Const ASSISTSEARCH_TYPE_UI%     = 8 '/*
   Works on the selectable object */
Const ASSISTSEARCH_TYPE_COUNT%    = 9 '/* 
   Total number of search types */

Const ASSISTINTERVAL_TYPE_NONE%    = 0 '/* 
   Unknown */
Const ASSISTINTERVAL_TYPE_MINUTES%   = 1
Const ASSISTINTERVAL_TYPE_DAYS%    = 2
Const ASSISTINTERVAL_TYPE_WEEK%    = 3
Const ASSISTINTERVAL_TYPE_MONTH%   = 4

Dim s As notessession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim agent As CAgent
Sub Initialize 
 Set s = New NotesSession
 Set db = s.currentdatabase
 Dim dbt As New notesdatabase("", "")
 Call dbt.open(db.server, "somedb.nsf")
 Set doc = New NotesDocument(dbt)
 
 doc.Form = "ParmDoc"
 doc.AgentName = "MyAgent"
 doc.Comment = "Last updated: " & Now
' ex: give it  a start time 
 doc.StartHour = 13
 doc.StartMinute = 30
 doc.AssistTrigger = ASSISTTRIGGER_
TYPE_SCHEDULED
 doc.AssistSearch = ASSISTSEARCH_TYPE_ALL
' ex: Run every hour and 30 minutes:
 doc.IntervalType = ASSISTINTERVAL_TYPE_
MINUTES
 doc.Interval = 90
 
 doc.IsEnabled = 1 
 Dim nn As New notesname(dbt.server)
 doc.RunOnServer = nn.canonical
 
 doc.Save False, True, True
 
 Set agent = New CAgent(doc)
 Call agent.BuildAgent()
 
 doc.Remove True
End Sub

MEMBER FEEDBACK TO THIS TIP

Notes R6 has XML support. It is very well-suited for a view, and any other design element creation and update.

—Giedrius L.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member T. Brian Nichols. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

This was last published in June 2004

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchExchange

SearchContentManagement

Close