您的位置:首页 > 其它

Database.Search 和 View.GetAllDocumentByKey

2010-10-21 10:10 405 查看
Database.Search

Dim sess As New NotesSession
Dim db As NotesDatabase
Dim strSearch As String
Dim dc as NotesDocumentCollection

Set db = sess.CurrentDatabase
strSearch = {Form="Example" & FormName="Example" & Doc_State!="Deleted" & @Date(CreationDate)=@Today }

Set dc = db.Search(strSearch,Nothing,0)


这里的strSearch即在View中的View Selection Formula:

以上dc的结果就相当于下面公式

SELECT Form="Example" & FormName="Example" & Doc_State!="Deleted" & @Date (CreationDate)=@Today

得到的View中的所有Document的集合。

View.GetAllDocumentByKey

Dim sess As New NotesSession
Dim db As NotesDatabase
Dim vw As NotesView
Dim dc As NotesDocumentCollection

Set db = sess.CurrentDatabase
Set vw = db.GetView("Example")
Set dc = vw.GetAllDocumentByKey("SearchKey",True)


这里的"SearchKey"是要搜索的关键字内容,一般是看View中文档的第一列的内容是否匹配,True指完全匹配,False指不完全匹配。

特别说明:搜索列必须设置为排序格式,即Column属性Sort不为None。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: