FTSearch

本文介绍使用Lotus Script进行数据库查询和文档搜索的方法,包括构建查询字符串、使用通配符以及执行搜索操作等实用技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Sub Initialize
 Dim s As New NotesSession
 Dim db As NotesDatabase
 Dim doc As NotesDocument
 Dim dc As NotesDocumentCollection
 Dim v As NotesView
 Dim v2 As NotesView
 Dim vc As NotesViewEntryCollection
 Dim z(5) As String
 
 Set doc = s.DocumentContext
 
 
 
 
 z(0)=doc.GetItemValue("PPage")(0)
 z(1)=doc.GetItemValue("PPxueli")(0)
 
 z(2)=doc.GetItemValue("PPzz")(0)
 z(3)=doc.GetItemValue("PPsex")(0)
 z(4)=doc.GetItemValue("PPzyjs")(0)
 z(5)=doc.GetItemValue("PPgrjs")(0)
 
 'If z = "不限" Then z="."
 
 Msgbox doc.GetItemValue("PPage")(0)
 Msgbox doc.GetItemValue("PPxueli")(0)
 Msgbox doc.GetItemValue("PPzz")(0)
 Msgbox doc.GetItemValue("PPsex")(0)
 Msgbox doc.GetItemValue("PPzyjs")(0)
 Msgbox doc.GetItemValue("PPgrjs")(0)
 
 Set db = s.CurrentDatabase
 Set v = db.GetView("Vname")
 Set v2 = db.GetView("SearchTemplate")
 Set vc= v2.AllEntries
 Call vc.RemoveAllFromFolder("SearchTemplate")
 '@date(2003;8;13)
 'searchfomular$="(Field birthday >= 2003-08-18 and Field birthday <= 2003-09-18)"
 'v2.FTSearch("",10)
 'Set dc=db.FTSearch("select  form="$$Viewtemplate for SearchTemplate" & (age>20 & age<30)")
 searchformula$={Form="$$Viewtemplate for SearchTemplate" & birthday >=2003-08-08}
 Set dc=db.FTSearch(searchformula$,Nothing,0)
 
 
 'Set dc = v.GetAllDocumentsByKey(z,False)
 'Call dc.PutAllInFolder("SearchTemplate",Nothing,0)
 
 
 Msgbox dc.Count
End Sub

 

 

 

searchFormula$   =  {Form   =   "表单1"&condition1=" "text1.text"&condition2= " "text2.text"&condition3>=}+@TextToTime(age1)+{&condition3<=}+@TextToTime(age2)

 

Set   collection   =   db.FTSearch(searchFormula$,nothing,0)

initialize:43:type mismatch

 

 

 

 

通配付问题

问题解决了,用Like   operator      
  ? Any   one   character  
  # Any   one   digit   from   0   through   9  
  * Any   number   of   characters   (zero   or   more)   
 

 

 

如要查找域a="a"   域b="b",可以在lotus   script中用以下语句:  
  queryStr={select   a="a"   &   b="b"}  
  set   dc=db.search(queryStr,nothing,0)  
  这样dc就是查询得到的文档集。

 


///
strKey="DBJLX='" &  curdoc.DBJLX(0) & "' & swrq>=@texttotime('" & curdoc.from(0) & "') & swrq<=@texttotime('" & curdoc.To(0) & "')
Set vc=view.AllEntries
Call vc.FTSearch(strKey,0)

///
searchFormula$   =   "Form   =   ""fmNewFile""   &   fdTitle   =""MyFile.txt"""  
  or    
  searchFormula$   =   "Form   =   ""fmNewFile""   |   fdTitle   =""MyFile.txt"""  

  Set   collection   =   db.Search(searchFormula$,nothing,0)

 

///
FTSearch(select form="formname" & (fieldname>20 & fieldname<30))
select form="something" & (fieldname>20 & fieldname<30 )
其中fieldname必须是数值域
 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值