Das Notes Forum
Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: MrMagoo am 08.08.03 - 13:59:40
-
Hallo, ich habe von DB ein Dokument zu DB1 kopiert.
Wie spreche ich das Dok jetzt am besten an? des per ID?
Ganz konkret möchte ich in Dok in der neuen DB noch ein Feld füllen
Dim session As New NotesSession
Dim db As NotesDatabase
Dim db1 As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set db1 = New NotesDatabase( "server" "DB1" )
Set collection = db.unprocessedDocuments
Set doc = collection.GetFirstDocument()
While Not(doc Is Nothing)
Call doc.CopyToDatabase(db1)
'hier möchte ich noch etwas ins Dok schreiben
Set doc = collection.GetNextDocument(doc)
Wend
-
Hi,
ich glaube so kommst du nicht weiter. Über die ID suchen kannst du nicht, da das Dokument in der anderen DB ein neue ID bekommt und du die nicht kennst.
Alternative Lösung wäre folgende:
Dim session As New NotesSession
Dim db As NotesDatabase
Dim db1 As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim docB As NotesDocument
Set db = session.CurrentDatabase
Set db1 = New NotesDatabase( "server" "DB1" )
Set collection = db.unprocessedDocuments
Set doc = collection.GetFirstDocument()
While Not(doc Is Nothing)
Set docB = New NotesDocument( db1 )
Call doc.CopyAllItems( docB, True )
docB.Feld = "Wertzuweisung"
Call docB.Save( True, True )
Set doc = collection.GetNextDocument(doc)
Wend
Vorraussetzung ist, das die Maske in der zweiten DB vorhanden ist.
Ich hab's nicht getestet, müsste aber funktionieren.
Axel
-
probiere ich mal, danke
-
die Lösung von Axel funktioniert prima, danke.
Vielleicht noch als kleiner Tipp,
ich lasse in beiden Dokumenten die IDs auslesen und in das jeweils andere (also Original oder Kopie) schreiben. so kann ich immer wieder das Dokument und seine Kopie ansprechen