Manage Learn to apply best practices and optimize your operations.

Creating Time/Date Calendar Entry

Every week an agent runs in our sales database that creates entries for the
next week. The orginal agent was calling the server over and over to get
dates, so I created this agent that calls the server once.
This agent creates a new doc in a db, but there needs to be excisting document
to call.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim newdoc As NotesDocument
Dim item As NotesItem

Set db=session.currentdatabase
Set view = db.GetView("(Name of View)")
REM I have the following code in the view
'SELECT (form = "Name of Form") & DateField Name
Set doc = view.GetFirstDocument
Set todaydatetime = New notesdatetime ("today")
temp = cdatx11

Call todaydatetime.adjustday (11)
Call todaydatetime.adjustday (1)
Call todaydatetime.adjustday (1)
Call todaydatetime.adjustday (1)
Call todaydatetime.adjustday (1)
Call todaydatetime.adjustday (1)
Call todaydatetime.adjustday (1)

While Not (doc Is Nothing)
Set newdoc = New NotesDocument (db)
Call doc.CopyAllItems( newdoc, True)
newdoc.form = doc.form(0)

REM all the days of the week & Wheres are field names in my form

Call newdoc.replaceitemvalue("WeekStarting", Cdat (x11))
Call newdoc.replaceitemvalue("Monday", x11)
Call newdoc.replaceitemvalue("Tuesday", x12 )
Call newdoc.replaceitemvalue("Wednesday", x13 )
Call newdoc.replaceitemvalue("Thursday", x14 )
Call newdoc.replaceitemvalue("Friday", x15)
Call newdoc.replaceitemvalue("Saturday", x16 )
Call newdoc.replaceitemvalue("Sunday", x17 )

Call newdoc.replaceitemvalue("WhereMonday", "" )
Call newdoc.replaceitemvalue("WhereTuesday", "")
Call newdoc.replaceitemvalue("WhereWednesday", "" )
Call newdoc.replaceitemvalue("WhereThursday", "")
Call newdoc.replaceitemvalue("WhereFriday", "")
Call newdoc.replaceitemvalue("WhereSaturday", "")
Call newdoc.replaceitemvalue("WhereSunday", "")

Call newdoc.Save(True,True)

Set doc = view.GetNextDocument(doc)


Dig Deeper on Domino Resources - Part 3

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials'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 ...