Das Notes Forum
Domino 9 und frühere Versionen => ND6: Entwicklung => Thema gestartet von: Gogun_Beokz am 21.10.05 - 09:44:03
-
Hallo,
ich habe folgendes Problem, die Anzahl der doc.responses wird irgentwo gespeichert und sobald ich ein Antwortdokument lösche kommt beim Speichern der Fehler "Notes Error: Dokument wurde gelöscht. Im Debugger stehen dann auch in dc soviele Werte wie vorm löschen. Gibt es eine Möglichkeit die Funktion doc.responses zu erneuern? Wenn ich ein Anwortdokument hinzufüge gibt es kein Problem.
Script:
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim adoc As NotesDocument
Dim success As Boolean
Set db = session.CurrentDatabase
success = True
Call source.Reload
If Source.IsNewDoc Then Exit Sub 'Wenn UIDoc neu ist dann verlasse Script
Set doc = Source.Document 'Doc zu Backend-doc
'alle Antwortdocs des Backend-Docs werden in die Collection aufgenommen
Set dc = doc.Responses
'Setze alle Felder der Collection, gespeichert wird automatisch
Call dc.StampAll( "SysFlagEditAccessLocked" , doc.SysFlagEditAccessLocked(0) )
Call dc.StampAll( "Creator" , doc.Creator(0) )
Set adoc = dc.GetFirstDocument
success = adoc.ComputeWithForm( False, False )
While Not adoc Is Nothing
success = adoc.ComputeWithForm( False, False )
If success Then
Call adoc.Save(False,False)
End If
Set adoc = dc.GetNextDocument(adoc)
Wend
End Sub
MFG
GoGuN_B3okZ
-
Die Responses-Collection enthält unter bestimmten Voraussetzungen auch die Deletionstubs gelöschter Dokumente. Siehe http://www-1.ibm.com/support/docview.wss?uid=swg21091615
So sollte es funktionieren:
Set adoc = dc.GetFirstDocument
While Not adoc Is Nothing
If adoc.IsDeleted Then
' nix
Else
success = adoc.ComputeWithForm( False, False )
If success Then
Call adoc.Save(False,False)
End If
End If
Set adoc = dc.GetNextDocument(adoc)
Wend
Gruß
Peter
-
Danke Peter
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim adoc As NotesDocument
Dim success As Boolean
Dim a As Variant
Dim b As Variant
Set db = session.CurrentDatabase
success = True
Call source.Reload
If Source.IsNewDoc Then Exit Sub 'Wenn UIDoc neu ist dann verlasse Script
Set doc = Source.Document 'Doc zu Backend-doc
Set a = doc.getfirstitem("SysFlagEditAccessLocked")
Set b = doc.getfirstitem("creator")
'alle Antwortdocs des Backend-Docs werden in die Collection aufgenommen
Set dc = doc.Responses
Set adoc = dc.GetFirstDocument
While Not adoc Is Nothing
If adoc.IsDeleted Then
' nix
Else
Call a.copyitemtodocument(adoc,"SysFlagEditAccessLocked")
Call b.copyitemtodocument(adoc,"Creator")
success = adoc.ComputeWithForm( False, False )
If success Then
Call adoc.Save(False,False)
End If
End If
Set adoc = dc.GetNextDocument(adoc)
Wend
End Sub
so funktioniert es! Ich musste auch das Stampall rausnehmen da hier die dc Anzahl ja auch falsch war.
MFG
G0guN_Beokz