Hi, I have a WebQuerySave agent where I’m trying to validate some data entry in a view. Basically, I’m wanting to check if there’s a date listed in a view, then I want to print an error message. Basically, the error is not occurring, and its processing the entry. My view column is sorted, ascending in a “general” format, so I can capture the datelist as a String. Why am I not erroring out when I plug in a date string that’s already in the view?
Dim session As New NotesSession
Dim db As NotesDatabase
Dim viewdate As NotesView
Dim vc2 As NotesViewEntryCollection
Dim DateListStart As String
’ now I get all the entries for the next collection
Set viewdate = db.GetView("XXX")
Set vc2 = viewdate.GetAllEntriesByKey(DateListStart,False)
If vc2.Count > 0 Then
doc.WebMessage = "xxxx."
Print printmsg
Exit Sub
End If
I wish I could say that worked, but its not. The reason I’m having to convert the dates to a string is because I’m using @Explode on the form to string out a list of dates with the following formula:
To debug in a WebQuerySave you can MsgBox and the value will appear in the server’s log.nsf.
Also, I was going to suggest earlier (but got tied up with other stuff), you might want to use Format instead of CStr (I know I had suggested CStr previously, but Format will give you greater control).
Also, you still have the option of storing the exploded values as an array of dates by the simple modification:
The above will create your date list in the format “yyyy.mm.dd” within the multi-value date field, while the Format statement below achieves the same for the search:
Format(doc.DateListStart(0), “yyyy.mm.dd”)
Lastly, I hope that the field DateListStart has been declared as multi-value or else you will explode the date list but upon saving, the field will become one long string of semicolon separated values and of course no search against that column will succeed.