Search for a date between given ranges - Lotus

Posted by Kris.Mitchell on Stack Overflow See other posts from Stack Overflow or by Kris.Mitchell
Published on 2010-03-19T18:07:16Z Indexed on 2010/03/19 19:41 UTC
Read the original article Hit count: 288

Filed under:
|

I have been trying to work out what is the best way to search for gather all of the documents in a database that have a certain date.

Originally I was trying to use FTsearch or search to move through a document collection, but I changed over to processing a view and associated documents.

My first question is what is the easiest way to spin through a set of documents and find if a date stored in the documents is greater than or less than a specified date?

So, to continue working I implemented the following code.

If (doc.creationDate(0) > cdat(parm1)) 
  And (doc.creationDate(0) < CDat(parm2)) then
  ...
end if

but the results are off

Included! Date:3/12/10 11:07:08 P1:3/1/10 P2: 3/5/10
Included! Date:3/13/10 9:15:09 P1:3/1/10 P2: 3/5/10
Included! Date:3/17/10 16:22:07P1:3/1/10 P2: 3/5/10

You can see that the date stored in the doc is not between P1 and P2. BUT! it does limit the documents with a date less than P1 correctly. So I won't get a result for a document with a date less than 3/1/10

If there isn't a better way than the if statement, can someone help me understand why the two examples from above are included?

© Stack Overflow or respective owner

Related posts about lotusscript

Related posts about dates