Domino 9 und frühere Versionen > Entwicklung

Eine Collection die eine View abarbeitet und gewisse Dokumente löscht

<< < (2/2)

Don Pasquale:
@Gruenkohl

 ;D  

Jetzt baust Du aber ein Fahrrad.


Ich halte das für die sauberere Lösung. Der Haken wäre nur ein Overflow in der LIST.


Ciao

Don Pasquale

Axel:
Hi,

wir wär's den mit diesem Ansatz ?

...
Set doc = collection.GetFirstDocument
While Not (doc Is Nothing)
  Set tmpdoc = collection.GetNextDocument(doc)
      If doc.Kriterium(0) = "JA" Then
         Call collection.DeleteDocument(doc)
      End If
  Set doc = tmpdoc
Wend  'While Not (doc Is Nothing)

Call collection.RemoveAll( True )
...


Axel

Thomas Schulte:
Die Lösung von Axel ist die eleganteste Weil sie alle Löschoperationen am Ende durchführt. Aber es geht auch so:
   Const VIEW_AKTUELL = "($ALL)"
   
   Dim ws As New NotesUiWorkspace
   Dim view As NotesView
   Dim session As New NotesSession
   Dim Doc As NotesDocument
   Dim Olddoc as notesdocument
         
   Set db = session.CurrentDatabase  
   Set view = db.GetView(VIEW_AKTUELL)
   Set doc = view.GetFirstDocument
   
   While Not doc Is Nothing
   set olddoc = doc  
      If doc.Kriterium(0) = "JA" Then
       call doc.remove(true)
       Set doc = view.GetNextDocument(Olddoc)
      End If
    Wend
   
   Set doc = Nothing
   
   Set view = db.GetView(VIEW_AKTUELL)
   Call ws.viewrefresh()  

N.B. Diese Art der Verarbeitung gilt übrigens auch, wenn du z.B. durch eine View marschierst und in einzelnen Dokumenten abhängig von deinem Status etwas änderst. In dem Moment wo du einen Doc.Save brauchst musst du mit diesem Schema arbeiten.

Thomas

Glombi:
@Don Pasquale:
Laut Hilfe muss ListTag ein String sein - ich habe das nur zitiert. Du verwendest ein Integer. Das sollte also nicht gehen. Falls doch, stimmt die Hilfe nicht ganz (wie so oft).


Andreas

Navigation

[0] Themen-Index

[*] Vorherige Sete

Zur normalen Ansicht wechseln