lotus-notes - Lotus notes 从另一个不工作的集合中减去集合
问题描述
请任何人都可以帮助我在 Lotus notes 从另一个不工作的集合中减去集合。dc1 和 dc2 收集计数都在工作,但无法从 dc2 中减去 dc1
它在给
错误 4336 方法参数的对象类型无效 在行:调用 dc2.Subtract(dc1)
请找到代码:
Sub sendNotificationAppOwnerMerged(coll As NotesDocumentCollection)
On Error GoTo errorhandler
Dim sess As NotesSession
Dim db As NotesDatabase
Dim dc1 As NotesDocumentCollection
Dim dc2 As NotesDocumentCollection
Dim doc As NotesDocument
Dim query As String
If coll.Count = 0 Then Exit Sub
Set dc2= coll.Clone()
Set doc = dc2.GetFirstDocument
While Not doc Is Nothing
Set doc = dc2.GetFirstDocument
query = | Field SATTEAMNAME = "| & doc.SATTeamName(0) & |"|
Set dc1= dc2.Clone()
Call dc1.Ftsearch(query, 0)
MsgBox dc2.count
MsgBox dc1.count
' send email to all apps in dc1
MsgBox "Mail Sent to " + doc.SATTeam(0)
Call dc2.Subtract(dc1)
If dc2.count = 0 Then Exit Sub
Wend
Exit Sub
errorhandler:
MessageBox "Error" & Str(Err) & ": " & Error$ & "On Line " & cstr(Erl)
Exit Sub
End Sub
解决方案
要减去的集合必须在要减去的集合中。
尝试:
Sub sendNotificationAppOwnerMerged(coll As NotesDocumentCollection)
On Error GoTo errorhandler
Dim sess As NotesSession
Dim db As NotesDatabase
Dim dc1 As NotesDocumentCollection
Dim dc2 As NotesDocumentCollection
Dim doc As NotesDocument
Dim query As String
If coll.Count = 0 Then Exit Sub
Set dc1= coll.Clone()
Set doc = dc1.GetFirstDocument
While Not doc Is Nothing
query = | Field SATTEAMNAME = "| & doc.SATTeamName(0) & |"|
Set dc2= dc1.Clone()
Call dc2.Ftsearch(query, 0)
MsgBox dc2.count
MsgBox dc1.count
' send email to all apps in dc1
MsgBox "Mail Sent to " + doc.SATTeam(0)
Call dc1.Subtract(dc2)
If dc1.count = 0 Then Exit Sub
Set doc = dc1.GetFirstDocument
Wend
Exit Sub
End Sub
虽然如果 dc1 中的第一个 doc 从未从 dc1 集合中减去,则可能会出现无限循环。可能有更好的方法来做到这一点。错误发生在第一次尝试还是之后?不断从 dc1 中减去然后重新克隆 dc2 也可能会导致错误。
推荐阅读
- html - 具有广色域支持的响应式图像标签
- android - 单击按钮时将 EditText 文本转换为大写和小写?
- javascript - 如何检测列表的任何链接是否处于活动状态。并向父母申请css课程
- android - 是什么阻止了 MIT App Inventor 中屏幕的启动?
- python - 使用 pyodbc 和 SQL Server 一般网络错误更新语句
- solr - Sitecore 8.2 更新 5 Ninject Solr 支持包问题
- php - Php SoapClient 在第一次连接时很慢
- r - 在具有条件的矩阵中查找第 n 个百分位数
- java - 请求未异步处理
- r - 将复选框矩阵转换为列名的边缘列表