I have a form that contains two date fields, a hidden field, a button and a table. The user enters in the start and end date that is used to pull in all documents within that date range into a table (acting as a view) to show the user. (The hidden field pulls in the date range and explodes all the dates) Now, this is a notes version and I would like to get it working as I’m going to web enable it. However, for some reason its not matching any documents when it should. I ran my code below through the debugger and the dc.Count always = 0 when it should’ve found a match.
Sub Click(Source As Button)
Dim counter As Integer
Dim allDates As Variant
Dim concatResults As String
Dim dc As notesdocumentcollection
Dim session As New NotesSession
Dim db As NotesDatabase
Dim lookupView As NotesView
Dim currDoc As NotesDocument
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Set db = session.CurrentDatabase
Set lookupView = db.GetView( "ABCD" )
counter = 0
Dim ws As New NotesUIWorkspace
Set uidoc = ws.CurrentDocument
If ( uidoc.FieldGetText("FieldToSearch")= "" ) Then
Msgbox "Please select a field to search on.",MB_ICONSTOP, "Firewall Query"
Exit Sub
Elseif ( (uidoc.FieldGetText("StartDate")= "" ) Or (uidoc.FieldGetText("EndDate") = "" ) )Then
Msgbox "Please enter a Start and End Date before you do your query.",MB_ICONSTOP, "Firewall Query"
Exit Sub
End If
If uidoc.FieldGetText("FieldToSearch") = "Completed Date" Then
Set lookupView = db.GetView( "ABCD" )
Else
Set lookupView = db.GetView( "ABSD" )
End If
Set currdoc = uidoc.Document
Call uidoc.Refresh
allDates = currdoc.GetItemValue("DatesExploded")
Forall v In allDates
Set dc = lookupView.GetAllDocumentsByKey(v,True)
If Not dc.Count = 0 Then
Set doc = dc.GetFirstDocument
While Not doc Is Nothing
counter = counter + 1
If uidoc.FieldGetText("FieldToSearch") = "Completed Date" Then
Set dTime = New NotesDateTime(Cstr(doc.CompletedDate(0)) )
concatResults = Cstr(dTime.DateOnly) & Chr(9) & Chr(9) & Cstr(doc.RequestNum(0)) & Chr(9) & Chr(9) & Cstr(doc.NameOfService(0))
Else
Set dTime = New NotesDateTime(Cstr(doc.ScheduledDate(0)) )
concatResults = Cstr(dTime.DateOnly) & Chr(9) & Chr(9) & Cstr(doc.RequestNum(0)) & Chr(9) & Chr(9) & Cstr(doc.NameOfService(0))
End If
Call uidoc.FieldAppendText("dResults",";" & concatResults)
Set doc = dc.GetNextDocument(doc)
Wend
End If
End Forall
If counter = 0 Then
Messagebox("No results were found for your search criteria.")
End If
Call uidoc.Refresh
End Sub
Anybody have any ideas as to why the GetAllDocumentsByKey method isn’t working? Its not matching any documents from the “DatesExploded” hidden field, when it should.