繁体   English   中英

VBA:Lotus Notes文档中的FTSearch语法

[英]VBA : FTSearch syntax in lotus notes documents in view

需要有关VBA代码的帮助。 请查看下面的代码。

我希望视图QA \\ QA Schedule中的所有文档都在(1sep2013-30sep2013)之间。 在这里它不是文档创建的日期,而是从视图列中获取的日期,以便我可以在Excel中提取数据

“下面是我建立的代码,它正在搜索所有文档并获取需要大量时间的数据。 如果可以在日期上添加过滤器,我们可以更快一些,但是我不知道FT搜索语法。 如何在视图列上使用它。 请为此提供帮助,这一点非常紧急。

Dim nSess As Object 'NotesSession
Dim sPwd As String
Dim strCnxn As String
Dim strSQL As String
Dim db As Object
Dim iviews As Object
Dim IView As Object
Set nSess = CreateObject("Lotus.NotesSession") 'New:{29131539-2EED-1069-BF5D-        00DD011186B7}
myUsername = ****
myPassword = ****
DSN1 = ("Driver={Lotus NotesSQL Driver (*.nsf)};Server=;Database=;Uid=" & myUsername & ";Pwd=" & myPassword & ";")
Call nSess.Initialize(sPwd)
Set db = nSess.GetDatabase("", "")
Set iviews = db.GetView("QA\QA Schedule")
iviews.AutoUpdate = False 
Set IView = iviews.AllEntries

Set viewparentEntry = IView.Parent

Set viewEntry = viewparentEntry.GetFirstDocument
For i = 1 To IView.Count

Colval = viewEntry.ColumnValues()
For j = 0 To 20
If Colval(0) <> "2013 9" Then
Exit For
ElseIf Colval(18) >= "" Or Colval(18) <= "" Then
Exit For
ElseIf Colval(18) >= "09/01/2013" Or Colval(18) <= "09/30/2013" Then
Sheets("Sheet2").Cells(RowCount, colcount).Value = Colval(j)
colcount = colcount + 1
Else
Exit For
End If
Next
j = 0
colcount = 1
RowCount = RowCount + 1
Set viewEntry = viewparentEntry.GetNextDocument(viewEntry)
Next

有几种选择:

  • 您可以复制此视图或将此视图更改为仅显示特定日期范围内的文档(如果适用)。

  • 您可以在数据库视图上调用FTSearch方法。 全文搜索的语法信息在这里

这是一个示例,可为您提供从视图上的全文搜索返回的doc集合:

Dim db As Object
Dim iviews As Object
Dim IView As Object
Dim doc as NotesDocument
Set nSess = CreateObject("Lotus.NotesSession") 'New:{29131539-2EED-1069-BF5D-        00DD011186B7}
myUsername = ****
myPassword = ****
DSN1 = ("Driver={Lotus NotesSQL Driver (*.nsf)};Server=;Database=;Uid=" & myUsername & ";Pwd=" & myPassword & ";")
Call nSess.Initialize(sPwd)
Set db = nSess.GetDatabase("", "")
Set iviews = db.GetView("QA\QA Schedule")
iviews.AutoUpdate = False 
iviews.FTSearch("[SomeDate] >= 9/1/2013 And [SomeDate] <= 9/30/2013")

Set doc = iviews.GetFirstDocument
While Not (doc Is Nothing)
    // Do something here for each document

    Set doc = iviews.GetNextDocument(doc)
Wend   

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM