我的问题是,当使用GetAllDocumentByKey
获取所有包含"键"的文档时是多个键,但使用下面代码的结果不能得到所有
例如,有时仅返回2个文档,但它应该返回5个包含该键的文档。
我该如何解决这个问题?
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim dc As NotesDocumentCollection
Set db = session.CurrentDatabase
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim doc As NotesDocument
Dim keys( 0 To 1 ) As Variant
'Dim vc As NotesViewEntryCollection
Dim defect As Variant
defect = uidoc.FieldGetText("DefectMode")
keys( 0 ) =defect
Dim PartNo As Variant
partNo = uidoc.FieldGetText("PartNo")
keys( 1 ) = partNo
Set view = db.GetView("EmbedView2" )
Set dc = view.GetAllDocumentsByKey(keys,False)
'Set vc=db.GetView("EmbedView2")
Call dc.PutAllInFolder("EmbedFolder")
Call workspace.DialogBox( "Embedded form", True, True, True, True, False, False, "Select Part No",,True,True )
'Call dc.RemoveAllFromFolder( "EmbedFolder" )
End Sub
答案 0 :(得分:0)
您是否尝试单独处理每个键值?
Set view = db.GetView("EmbedView2" )
ForAll key in keys
Set dc = view.GetAllDocumentsByKey(key,False)
Call dc.PutAllInFolder("EmbedFolder")
end ForAll
[编辑]为了解问题所在,检查您的密钥是否确实返回数据。查看每个键的输出。
Set view = db.GetView("EmbedView2" )
ForAll key in keys
Set dc = view.GetAllDocumentsByKey(key,False)
print "*** for " + key + " number or matching: " & dc.Count
Call dc.PutAllInFolder("EmbedFolder")
end ForAll