Domino 9 und frühere Versionen > Entwicklung

Problem mit der Übergabe von Dokumenten unter R5

<< < (2/4) > >>

klaussal:
... klaro, da fehlen ja auch noch die ganzen dim und set anweisungen.
ich weiss nicht, ob es viel sinn macht, den kompletten code zu posten, wenn das "gegenüber" keine ahnung davon nicht hat.

wenn man leute an solche aufgaben setzt, dann sollen die auch eine ausbildung bekommen.

PAR003:
Hi,
bei mir ist es halt so das Ich ein FOS-Praktikant bin.
Das was Ich machen soll ist ein Projekt zu bearbeiten.
Thnx PAR003

klaussal:
... ich habe erbarmen:

--- Code: ---Sub Initialize
   Dim doc As NotesDocument
   Dim docNew As NotesDocument
   Dim docRemove As NotesDocument
   Dim view As NotesView
   Dim dbvon As NotesDatabase
   Dim dbziel As NotesDatabase
   Dim session As NotesSession
   Dim viewneuedocs As notesview
   Dim strServer As String
   Dim zaehl1 As Integer
   Dim zaehl2 As Integer
   
   Set session = New NotesSession
   Set dbvon = session.currentDatabase
   strServer = dbvon.server
   Set dbziel = session.GetDatabase(strServer , "xxx\yyy.nsf")
   Set docNew = dbziel.createDocument
   
   If Not dbziel.isOpen Then
      strFehler = "Zieldatenbank : xxxx lässt sich nicht öffnen"
      Exit Sub
   End If
   
   '-------- zuerst die alten documente löschen
   zaehl1 = 0   
   Set viewneuedocs = dbziel.getview("neue_docs_aus_xxx")
   Set docRemove = viewneuedocs.getfirstDocument   
   Do While Not docRemove Is Nothing
      Call docRemove.Remove(True)
      zaehl1 = zaehl1 + 1
      Call viewneuedocs.refresh
      Set docRemove = viewneuedocs.getfirstDocument   
   Loop
   
   '-------- und jetzt die neuen erstellen
   zaehl2 = 0
   Set view = dbvon.getView("neue_docs")
   Set doc = view.getfirstDocument
   Do While Not doc Is Nothing
      Set docNew = dbziel.createDocument
      Call doc.CopyAllItems(docNew, True)
      docNew.neu = "1"
      Call docNew.Save(True, True)
      zaehl2 = zaehl2 + 1
      Set doc = view.getNextDocument(doc)
   Loop
   
   '------------------------------------------------------------
   ' protokoll erstellen
   Dim docProtokoll As NotesDocument
   Dim rtitem As NotesRichTextitem
   Dim agent As NotesAgent
   Dim dateTime As New NotesDateTime( "" )
   Dim varDummy As Variant
   Set agent = session.CurrentAgent
   Set docProtokoll = dbvon.createDocument
   
   docProtokoll.form = "protokoll"
   docProtokoll.name = agent.Name
   Call dateTime.SetNow
   'Set docProtokoll.datum_agent = dateTime
   Set rtitem = New NotesRichTextItem (docProtokoll, "protokoll")   
   Call rtitem.AppendText( "Anzahl Dokumente gelöscht :" + Cstr(zaehl1))
   Call rtitem.AddNewLine( 1 )
   Call rtitem.AppendText( "Anzahl Dokumente neu        :" + Cstr(zaehl2))
   varDummy = docProtokoll.ComputeWithForm( False, False )
   Call docProtokoll.Save( False, True )
   
End Sub

--- Ende Code ---

die namen müssten angepasst werden.

PAR003:
Hi,
Eigentlich will Ich die originale Maske nicht mehr benutzen.
Bloß wenn Ich sie weglasse so kommt eine Fehlermeldung.
Ich will nur die Dokumente haben.
Die  originale Maske würde Ich gerne verwerfen und nur noch die neue benutzen.
Hier ist der "umgewandelte" Code:
Sub Initialize
   Dim doc As NotesDocument
   Dim docNew As NotesDocument
   Dim docRemove As NotesDocument
   Dim view As NotesView
   Dim dbvon As NotesDatabase
   Dim dbziel As NotesDatabase
   Dim session As NotesSession
   Dim viewneuedocs As notesview
   Dim strServer As String
   Dim zaehl1 As Integer
   Dim zaehl2 As Integer
   
   Set session = New NotesSession
   Set dbvon = session.currentDatabase
   strServer = dbvon.server
   Set dbziel = session.GetDatabase(strServer , "Test3.nsf")
   Set docNew = dbziel.createDocument
   
   If Not dbziel.isOpen Then
      strFehler = "Zieldatenbank : Test3.nsf lässt sich nicht öffnen"
      Exit Sub
   End If
   
   
   
   '-------- und jetzt die neuen erstellen
   zaehl2 = 0
   Set view = dbvon.getView(" BookNr_V")
   Set doc = view.getfirstDocument
   Do While Not doc Is Nothing
      Set docNew = dbziel.createDocument
      Call doc.CopyAllItems(docNew, True)
      docNew.neu = "1"
      Call docNew.Save(True, True)
      zaehl2 = zaehl2 + 1
      Set doc = view.getNextDocument(doc)
   Loop
   
   '------------------------------------------------------------
   ' protokoll erstellen
   Dim docProtokoll As NotesDocument
   Dim rtitem As NotesRichTextitem
   Dim agent As NotesAgent
   Dim dateTime As New NotesDateTime( "" )
   Dim varDummy As Variant
   Set agent = session.CurrentAgent
   Set docProtokoll = dbvon.createDocument
   
   docProtokoll.form = "protokoll"
   docProtokoll.name = agent.Name
   Call dateTime.SetNow
   'Set docProtokoll.datum_agent = dateTime
   Set rtitem = New NotesRichTextItem (docProtokoll, "protokoll")  
   Call rtitem.AppendText( "Anzahl Dokumente gelöscht :" + Cstr(zaehl1))
   Call rtitem.AddNewLine( 1 )
   Call rtitem.AppendText( "Anzahl Dokumente neu        :" + Cstr(zaehl2))
   varDummy = docProtokoll.ComputeWithForm( False, False )
   Call docProtokoll.Save( False, True )
End Sub


Thnx PAR003

klaussal:
... zeile docNew.neu = "1" kann raus.

anstatt "copyallItems" muss dann feld für feld gemoved werden.
docNeu.form = "deinmaskenname"
docNeu.neuerfeldname = doc.alterfeldname(0)
usw.
usw.
achtung bei felder, die wo mehrfachwerte haben !

Navigation

[0] Themen-Index

[#] Nächste Seite

[*] Vorherige Sete

Zur normalen Ansicht wechseln