Search code examples
lotus-noteslotus-dominolotuslotusscript

How do I Use a Date in an Array in GetAllEntriesByKey?


I'm trying to use the current day in GetAllEntriesByKey by passing an array. The array so far looks like this

Dim keyarray(2) As Variant  
keyarray(0) = "FF Thompson ADT"  
Set keyarray(1) = dateTime  

I would like to say this

Set vc = view.GetAllEntriesByKey(keyarray, False)  

Here is a row of what it looks like when it works. The test agent prints out csv in an email.

FF Thompson ADT,2/3/2009,11:45:02 PM,0,6,0,,00:00:04,5400,4

I can't seem to pass a current day dateTime that runs. I can set the dateTime manually in the declaration and it works. I think it's because it's trying to also pass the time but I don't know. I have tried three ways and it says invalid key value type.

Dim dateTime As New NotesDateTime("")
Call dateTime.LSLocalTime = Now
...
keyarray(1) = dateTime.Dateonly

Dim dateTime As New NotesDateTime("")
Call dateTime.SetNow
...
keyarray(1) = dateTime.Dateonly

Dim dateTime As New NotesDateTime("Today")
...
keyarray(1) = dateTime.Dateonly

I don't know if this is useful but I read about Evaluate here.

What I'm ultimately trying to do is GetFirstEntry for "FF Thompson ADT" for the most recent day entries exist. I'm also trying to do the same for the day before that. I'm trying to sum up the files processed (the number 6) for both days and errors (the null) for the most recent day using something like this. I need to tweak it so it finds the files processed and errors for entries but I haven't gotten there but should be able to do. I'm also just trying to find the most recent date with time value for the feed ie "FF Thompson ADT".

Set entry = vc.GetFirstEntry
filesprocessed = 0
Dim errors, errortotal As Integer
errors = 0
errorstotal = 0
While Not entry Is Nothing
  rowval = 0
  errors = 0
  Forall colval In entry.ColumnValues
    If rowval > 0 Then
      errors = Cint(colval)
    Else
      rowval = Cint(colval)
    End If
  End Forall
  filesprocessed = filesprocessed + rowval
  errorstotal = errorstotal + errors
  Set entry = vc.GetNextEntry(entry)
Wend

Thanks for any help or suggestions. They are greatly appreciated.


Solution

  • Here's an answer I found

    Dim todaysdate As New NotesDateTime("Today")
    Dim dateTime As New NotesDateTime(todaysdate.DateOnly)
    
    Dim keyarray(1) As Variant keyarray(0) = feedname
    Set keyarray(1) = dateTime 
    
    Set vc = view.GetAllEntriesByKey(keyarray, False)