Agent Example of Working with TimeDate Values and Setting a Field with One

Author: Tripp W Black

Created: 12/05/2000 at 08:42 PM

 

Category:
Notes Developer Tips
Agents, LotusScript

'... Dim Session & Db

Dim doc As NotesDocument
Dim item As NotesItem
Dim Expire As NotesDateTime
'...set value of doc...
Set item = doc.GetFirstItem( "EventDate" )
Set Expire = New NotesDateTime( "Today" )
Set item.DateTimeValue = Expire
Call doc.Save( False, True )

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim Form As NotesItem
Dim temp As Variant ' Used for temporary field assignments
Dim success As Variant
Dim Expire As New NotesDateTime( "" )
Dim EventDate As NotesItem

Set db = session.CurrentDatabase
Set collection = Db.UnProcessedDocuments
Set doc = collection.GetFirstDocument
Do While Not(doc Is Nothing)
Set Form=doc.ReplaceItemValue("Form", "News")
doc.Description = doc.From(0) & " - " & doc.Subject(0)
doc.Title = doc.Subject
doc.Stats = "No"
doc.Title = doc.Subject
doc.PublishDate = doc.Created
Expire.LSLocalTime = doc.Created
Call Expire.AdjustDay(1)
Set EventDate =doc.ReplaceItemValue("EventDate", Expire)
doc.Category = "Home"
doc.Categories = "News"
doc.Notified = "Yes"
Set temp = doc.ReplaceItemValue( "$PublicAccess", "1" )
doc.Private = "0"

success = doc.ComputeWithForm( False, False )
If success Then
Call doc.Save( True, True )
End If
Set Doc=collection.GetNextDocument (doc)
Loop
End Sub


previous page