I have a statement below. It goes out to a view sorted by date and grabs the document that starts with that date.
Set emaildoc = emailview.GetDocumentByKey(Adhocdoc.StartDate(0))
Here’s my problem. I have a start date and an end date to specify. If when I go to grab the first document, it does find one with that date, the agent stops. I need to adjust in increments until it hits the end date and try grabbing the next document. I would like to be able to figure out the number of days difference between the two dates and do an @Adjust in the evaluate statement with a lotusscript variable. Can this be done?
Dates are a royal pain to work with. I’ve tried changing to LotusScript dates and they just don’t speak to each other (Notes and LotusScript).
Subject: Can I combine a LS variable inside an evaluate statement?
@Formula and Lotusscript do indeed handle dates differently, but it’s not so bad… most of the time ;o)
Anyway, to answer your quesion, yes you can combine LS variables with an Evaluate statement. You just need to break it up like this (I’m not addressing your issue here, just presenting the idea from memory. The syntax is probably stuffed!):
SDate = Adhocdoc.StartDate(0) EDate = Cdat(Adhocdoc.EndDate(0))
Set edoc = emailview.GetDocumentByKey(SDate)
While Not (edoc Is Nothing)
If Cdat(edoc.DateField(0)) > EDate Then
Set edoc = Nothing
Else
'process your email doc
Set edoc = emailview.GetNextDocument(edoc)
End If
Wend
Subject: Can I combine a LS variable inside an evaluate statement?
If you just want to find the difference between two dates on your document, then you don’t even have to worry about Notes dates vs Lotusscript dates. Just do
Adhocdoc.EndDate(0) - Adhocdoc.StartDate(0)
to get the number of days.
If you do need to work with another date, such as Today’s date, the below script is an example of finding the number of days between Today and a date on a document:
Dim workspace As New Notesuiworkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim todayDate As New NotesDateTime("Today")
Dim docDate As NotesDateTime
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
Set docDate = New NotesDateTime(doc.date_hire(0))
Messagebox todayDate.LSLocalTime - docDate.LSLocalTime