rh71
No Lifer
Sorry for the urgency... I've been cracking my head for a while on this now... don't know what the prob is (not versed in Notes / LotusScript very much... need help figuring out why I'm getting an error:
when running a script containing this function:
varStartTime = Timevalue(personDoc.StartTime(0))
// persondoc is a document in the notes view... is there something wrong with how Timevalue() is being used ? This is R5.
Entire method:
Thanks.
Error encountered! Number 5 at line 18: Illegal function call
Error encountered! Number 200 at line 19: Attempt to access uninitialized dynamic array
Error encountered! Number 9 at line 20: Subscript out of range
Error encountered! Number 9 at line 21: Subscript out of range
Error encountered! Number 92 at line 31: FOR loop not initialized
when running a script containing this function:
varStartTime = Timevalue(personDoc.StartTime(0))
// persondoc is a document in the notes view... is there something wrong with how Timevalue() is being used ? This is R5.
Entire method:
Function IsPrimeShift(personDoc As NotesDocument, rl As runlog) As String
'This function takes a Person document from the Resolver settings database, reads the TimeZone, Start and End Time, and
'returns whether or not the person is in their locally defined prime shift
rl.logerr "starting IsPrimeShift function."
IsPrimeShift = "0" 'default as in prime shift
rl.logerr "IsPrimeShift manually set to 0."
Dim varStartTime As Variant, varEndTime As Variant, strTimeZone As String 'hold values from person document
Dim s As NotesSession, db As NotesDatabase, vTZ As NotesView, docTZ As NotesDocument
Dim varLocalTime As Variant 'converted system time to user's TimeZone
rl.logerr "setting VarStartTime..."
varStartTime = Timevalue(personDoc.StartTime(0))
rl.logerr "varStartTime is "+varStartTime
varEndTime = Timevalue(personDoc.EndTime(0))
rl.logerr "varEndTime is "+varEndTime
strTimeZone = personDoc.TimeZone(0)
rl.logerr "strTimeZone is "+strTimeZone
' get localized time
Set s = New NotesSession
Set db = s.currentDatabase
rl.logerr "getview (tzlookup)..."
Set vTZ = db.GetView("(TZLookup)")
If vTZ Is Nothing Then Exit Function
rl.logerr "getview successful..."
rl.logerr "getdocumentbykey now..."
Set docTZ = vTZ.GetDocumentbyKey(vTZ, False) 'was set to true
If docTZ Is Nothing Then Exit Function
rl.logerr "getdocumentbykey successful..."
varLocalTime = ReturnLocalTime(docTZ) 'convert time to user's TimeZone setting
rl.logerr "varLocalTime is "+varLocalTime
' figure out if this is Prime or not
If varStartTime < varEndTime Then
' prime does not span midnight
If varLocalTime > varStartTime And varLocalTime < varEndTime Then
IsPrimeShift = "1"
Else
IsPrimeShift = "0"
End If
Else
'prime spans midnight, local time must be EITHER larger than start OR smaller than end
If varLocalTime > varStartTime Or varLocalTime < varEndTime Then
IsPrimeShift = "1"
Else
IsPrimeShift = "0"
End If
End If
End Function
Thanks.