Das Notes Forum

Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: Rob Green am 04.03.03 - 14:01:22

Titel: Docs aus Collection entfernen
Beitrag von: Rob Green am 04.03.03 - 14:01:22
ich steh auf dem Schlauch..

will eigentlich was ganz simples..

in einer normalen

While Not Doc is Nothing
..Bedingung
Call Collection.DeleteDocument(Doc)
..
Set doc = Collection.GetNextDocument(Doc)
Wend

Natürlich sagt mir Notes dann nach dem ersten Löschen eines Docs aus der Notesdocumentcollection, daß das Doc nicht da ist, wenn er an die Stelle "Set doc = dc.GetNextDocument(Doc)" kommt.

Hm..wie ist der Ausweg?
Irgendwie bekomme ich den Trick mit 2 doc- (docA und docB) Zuweisungen auch nicht hin. Wie also mehrere Docs aus einec Coll löschen?
Titel: Re:Docs aus Collection entfernen
Beitrag von: Performance am 04.03.03 - 14:06:38
ich denke das geht in etwa so

While Not Doc is Nothing
..Bedingung

set doc2 = doc
..
Set doc = Collection.GetNextDocument(Doc)
Call Collection.DeleteDocument(Doc2)
Wend



cu
Titel: Re:Docs aus Collection entfernen
Beitrag von: Rob Green am 04.03.03 - 14:08:33
so vielleicht?

Code
While Not Doc is Nothing

  docB = doc

    If..Bedingung...Then
    Flag$="Löschen"
    End if

  Set doc = Collection.GetNextDocument(Doc)

    if Flag$= "Löschen" Then
    Call Collection.DeleteDocument(DocB)
    End If

Wend

also das verschieben der Zeile Call... nachdem das nächste Doc in der Coll geholt wird?

@edit: @Performance, lese gerade Dein Posting während ich meine eigene Antwort abgefeuert hatte...ein Mann ein Gedanke...ich denke, so passt es. Thx  :D
Titel: Re:Docs aus Collection entfernen
Beitrag von: Jérôme am 04.03.03 - 14:47:38
Dim docA As NotesDocument
Dim docB As NotesDocument
Dim col As NotesDocumentCollection

Set docA = col.GetFirstDocument

While Not (docA Is Nothing)
  Set docB = col.GetNextDocument (docA)
  Call col.DeleteDocument (docA)
  Set docA = docB
Wend


Könnte das gehen?

Gruß
- Jérôme
Titel: Re:Docs aus Collection entfernen
Beitrag von: Rob Green am 04.03.03 - 14:57:52
passt  :)