Domino 9 und frühere Versionen > ND6: Entwicklung

LotusScript: Dokumente durchsuchen und Feldinhalte ändern

<< < (2/3) > >>

m3:

--- Zitat von: klauss am 17.09.07 - 14:01:01 ---Durch die Änderung des CCC wird evtl. die View durcheinander gewirbelt und der GetNext funzt nicht mehr.

--- Ende Zitat ---
Jup, vermutlich.

Lösungsansatz für den Mönch: Die "passenden" Dokumente in einer NotesDocumentCollection bzw. NotesViewEntryCollection sammeln und über diese iterieren.

shaolinh:
Hallo, danke für eure Antworten und die hilfreichen Tipps. Ich denke das mag die Lösung des Problems sein. Ich werde es gleich mal testen. Vielen Dank für eure Hilfe!

Gruß,
shaolinh

shaolinh:
Hallo,

ich habe eure Tipps ausprobiert und bekomme immer wieder die gleiche Fehlermeldung. Sowohl mit einer NotesDocumentCollection und einer NotesViewEntryCollection. Der Fehler ist in Linie 112 "Object Variable not Set". In docContactEntry ist definitiv ein Dokument enthalten. Finde ich sehr komisch... Vielen Dank für Eure Hilfe!


Hier mein Code mit der NotesViewEntryCollection:

   Set docContactEntry = nav.GetFirstDocument
   
   'Gehe alle relevanten Kontakte für den Standort durch und füge sie einer Collection hinzu
   While Not (docContactEntry Is Nothing)
      Stop
      Call collectionTempView.AddEntry(docContactEntry) 'Line 112
      
      Set docNextContactEntry = nav.GetNextDocument(docContactEntry)
      Set docContactEntry = docNextContactEntry
   Wend
   
   If collectionTempView.Count = 0 Then 'Line 121
      Exit Sub
   Else
      Set docContactTempEntry = collectionTempView.GetFirstEntry
   End If
   
   
   'Iteriere durch die Kontakte und ersetze den CCC-Wert durch den neuen CCC-Wert   
   While Not (docContactTempEntry Is Nothing)
      Set docContactTempNextEntry = collectionTempView.GetNextEntry(docContactTempEntry)
      
      contactCCC = docContactTempEntry.Document.CCC
      
      Set tmp = New NotesDocument(db)
      tmp.CCC = contactCCC
      
      formula = |@Trim(@Replace(CCC;"| & oldCCCValue & |";"| & newCCCValue & |"))|
      Stop
      erg = Evaluate(formula,tmp)
      
      docContactTempEntry.Document.CCC = erg
      Call docContactTempEntry.Document.Save(True,True)
      
      Set docContactTempEntry = docContactTempNextEntry
   Wend

dirk_2909:
Vermutlich ist die "collectionTempView" nicht gesetzt !!

if collectionTempView  is Nothing Then _
Set collectionTempView = viewXYZ.GetAllDocumentsByKey( "~~$$§§$" , True )

shaolinh:
Hallo,

es hat geklappt. Nur musste ich meine Ansicht, die kategorisiert wurde, in eine nicht kategorisierte View umwandeln mit den entsprechenden Keys in sortierter Reihenfolge.

Kann mir jmd sagen, warum der unten stehende Code nicht klappt bzw. wie ich den Code umändere, damit es klappt? Muss ich collectionTempView in irgendeiner weise initialisieren? Danke für eure hilfreichen Tipps :)

Zusammengefasst:

Dim collectionTempView As NotesViewEntryCollection
...
Call collectionTempView.AddEntry(notesViewEntry) 'Fehler: Object Variable Not Set, collectionTempView is Nothing


Navigation

[0] Themen-Index

[#] Nächste Seite

[*] Vorherige Sete

Zur normalen Ansicht wechseln