Lotus notes Lotus notes从另一个不工作的集合中减去集合

Lotus notes Lotus notes从另一个不工作的集合中减去集合,lotus-notes,lotus-domino,lotusscript,lotus,Lotus Notes,Lotus Domino,Lotusscript,Lotus,有人能帮我吗 在Lotus notes中,从另一个不工作的集合中减去集合。 dc1和dc2收集计数都在工作,但无法从dc2中减去dc1 它是给予 错误4336第行的方法参数的对象类型无效:Call dc2.减法(dc1) 请查找代码: Sub sendNotificationAppOwnerMerged(coll As NotesDocumentCollection) On Error GoTo errorhandler Dim sess As NotesSession

有人能帮我吗 在Lotus notes中,从另一个不工作的集合中减去集合。 dc1和dc2收集计数都在工作,但无法从dc2中减去dc1

它是给予

错误4336第行的方法参数的对象类型无效:Call dc2.减法(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

要减去的集合必须位于要减去的集合中

尝试:


尽管如果从不从dc1集合中减去dc1中的第一个文档,可能会出现无限循环。也许有更好的方法可以做到这一点。错误发生在第一次尝试时还是之后?不断地从dc1中减去,然后重新克隆dc2也可能会导致错误。

我的记忆中说,FTSearch方法返回的NotesDocumentCollection是有序的,它实际上是与其他方法返回的NotesDocumentCollection不同的集合类型。我怀疑这个错误是想告诉您不能从无序集合中减去有序FT集合。我之所以这么说,是因为这段记忆是很久以前的事了。我同意。此外,减法是(或可能是)SLO w。最好自己编写减法,使用NotesDocumentCollection.DeleteDocument()。或者,在您的情况下,如果您想查找具有不同名称的团队的数量,请使用query=|!字段SATTEAMNAME=“|&doc.SATTEAMNAME(0)和|”|感谢您的回复。它发生在第一次尝试在“Call dc1.Subtract(dc2)”行执行时。我希望减法有效。任何其他方式也很有帮助。
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