搜索给定范围之间的日期 - 莲花 [英] Search for a date between given ranges - Lotus
问题描述
我一直在努力找出什么是搜索收集数据库中具有特定日期的所有文档的最佳方法。
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.
最初我是尝试使用FTsearch或搜索来移动文档集合,但我更改为处理视图和关联的文档。
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
但结果是关闭
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
您可以看到文档中存储的日期不在P1和P2之间。但!它确实限制日期小于P1的文档。所以我不会得到一个日期小于3/1/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语句更好的方法,可以
If there isn't a better way than the if statement, can someone help me understand why the two examples from above are included?
推荐答案
你可以尝试这样的事情:
Hi you can try something like this:
searchStr = {(Form = "yourForm" & ((@Created > [} & parm1 & {]) & (@Created < [} & parm2 & {])))}
Set docCollection = currentDB.Search(searchStr, Nothing, 0)
If(docCollection.Count > 0)Then
'do your stuff with the collection returned
End If
这篇关于搜索给定范围之间的日期 - 莲花的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!