Skip to main content
Information Mgmt
New to Lotus
How to buy
Live demos
Technical library
Forums & community
Java™ technology
Open source
SOA and Web services
Web development
My developerWorks
About dW
Submit content

developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 4 and 5 Forum

Notes/Domino 4 and 5 Forum



Compare today equal to or between two dates (Lotusscript)
Glenn R Packham 3.Jul.13 08:46 PM a Web browser
Domino Designer -- LotusScript All Releases All Platforms


I have a view that has OOO (Out of office) documents in it and a person the user is delegating their approvals to.

The document has a From and to date of type date/time and they use the calendar/time control to pick the dates. Display time is not checked. (Document properties show date as 22/05/2013 in case it is relevant.)

I am stepping through the view and comparing the next approver with an entry in the OOO View. When it finds one it checks if their OOO entry is current.

I can't for the life of me get it to work. :(

Any suggestions?

The code has had many variations - here is the latest. (Some code not relevant removed...)

Sub Click(Source As Button)

Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim OOOdoc As NotesDocument
Dim OOOvw As NotesView
Dim CurrentUser As String
Dim maildoc As NotesDocument
Dim rtitem As NotesRichTextItem
Dim RequestType As String
Dim CompanyName As String
Dim ApproverCount As Integer
Dim x As Variant
Dim TempApprover As Variant
Dim RoleAdd As String
Dim NewRoleUser As String
Dim NewRoleUser1 As String
Dim StateAppend As String
Dim TotalValue As Double
Dim TotalAUD As Double
Dim Subject As String
Dim MyName As String
Dim VSearch As String
' Today Date
Dim dtToday As New NotesDateTime(Today)
Dim test1 As Integer
Dim test2 As Integer

Dim nam1 As NotesName
Dim nam2 As NotesName

Set uidoc = workspace.CurrentDocument
Set doc = uidoc.document
Set db = session.CurrentDatabase

Dim fromDate As Variant, toDate As Variant

Set pdoc = db.GetProfileDocument("Settings")
Dim header As NotesItem, footer As NotesItem, mailsubject As notesItem
Set header = pdoc.GetFirstItem("NewManagerHeader")
Set footer = pdoc.GetFirstItem("NewManagerFooter")
Set mailsubject = pdoc.GetFirstItem("NewManagerSubject")


' See if OOO Set
' Step through each OOO Document
Set OOOvw = db.getview("OOO")
Set OOOdoc = OOOvw.GetFirstDocument()
While Not (OOOdoc Is Nothing)
' Look for a match
If (OOOdoc.OOOPerson(0) = doc.NextApprover(0)) Then
' Found a match for the user
fromDate = OOOdoc.getItemValue("OOOStart")(0)
toDate = OOOdoc.getItemValue("OOOEnd")(0)

If Not (Typename(fromDate) = "DATE" And Typename(toDate) = "DATE") Then
Error 9999, "From and To dates are not Date/Time"
End If

'Dim dtOOOStart As New NotesDateTime(OOOdoc.OOOStart(0))
'Dim dtOOOEnd As New NotesDateTime(OOOdoc.OOOEnd(0))
'test1 = (dtToday.TimeDifference(dtOOOStart))
'test2 = dtOOOEnd.DateOnly - dtToday.DateOnly
If fromDate >= Today() And toDate =< Today() Then
Set nam1 = doc.NextApprover(0)
Set nam2 = OOOdoc.OOODelegate(0)
Messagebox |Please note: Approver has an OOO active for today.

The approval process will be updated with the new Approver.|,64,"FYI"

'Update Approver Comments
DateasString = Format(Today, "dd/mm/yyyy")
AddText = Cstr(DateasString) + " - OOO Agent : Approver " + nam1.Common + " Out of Office."
doc.AppComments = Arrayappend(doc.AppComments, AddText)
AddText = Cstr(DateasString) + " - OOO Agent : New approver " + nom2.OOOdoc.OOODelegate(0)
doc.AppComments = Arrayappend(doc.AppComments, AddText)

'Replace the current approver with the delegate
doc.NextApprover = OOOdoc.OOODelegate(0)

'Set the OOOdoc to the first one so the check can happen again.
Set OOOdoc = OOOvw.GetFirstDocument()
End If
End If
Set OOOdoc = OOOvw.GetNextDocument(OOOdoc)

Any help would be great!



Compare today equal to or between t... (Glenn R Packham... 3.Jul.13)
. . RE: Compare today equal to or betwe... (Phil M Jones 5.Jul.13)
. . . . RE: Compare today equal to or betwe... (Glenn R Packham... 7.Jul.13)

  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

Forum use and etiquette
Native Notes Access
Web site Feedback

  Lotus Support
Lotus Support
Product support pages index
Search knowledge base (Technotes)
Search support downloads
Lotus Support RSS

IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
Notes/Domino 4 and 5
IBM Connections
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
IBM SmartCloud Meetings
IBM Web Content Manager
Lotus Domino Document Manager
Lotus e-learning
Lotus Enterprise Integration
Lotus Expeditor
Lotus Protector
Lotus Quickr
Lotus SmartSuite
Lotus Symphony
Lotus Symphony Developer Toolkit Support
Lotus Workflow