Domino 9 und frühere Versionen > Entwicklung

Export-Script

(1/3) > >>

Selin:
Hallo Ihr Lieben,


Habe hier ein Script zum Exportieren von Kontaktdaten aus dem Adressbuch in ein anderes Adressbuch.
Habe zwei Probleme.

1. ich versuche beim Export dem Dokument zu sagen, dass Form="Kontaktformular_" sein soll.
Das klappt zwar aber das aktuelle Dokument in meinem persönlichen Adressbuch bekommt dann auch Form = "Kontaktformular_" zugeteilt.
Das soll natürlich nicht passieren.

2. beim Export soll die zuständige Abteilung abgefragt werden. Und die Eingabe soll mit exportiert werden.In der DB, in die Dokumente exportiert werden existiert ein Feld "Abteilung". Da soll er es reinschreiben.
(Im Script ist die Inputbox auskommentiert)

Ich hoffe, ich konnt ees einigermaßen verständlich ausdrücken.

Danke + Gruß

Sub Initialize
   Dim s As New NotesSession
   Dim WS As New NotesUIWorkspace
   Dim View As NotesView
   Dim db As NotesDatabase
   Dim targetdb As New NotesDatabase( "Server", "Datenbank" )
   Dim dc As NotesDocumentCollection
   Dim source As NotesUIDocument
   Dim checkdc As NotesDocumentCollection
   Dim doc As NotesDocument
   Dim Flag As Variant
   Dim SucheName() As String
   Dim Unids() As String
   Dim Abtei() As String
   Dim tmpdoc As NotesDocument
   Dim modifyDate As Variant
   Dim i As Integer
   Dim found As Integer
   Dim abt As String
   
   Set db = s.CurrentDatabase
   Set checkdc = db.UnprocessedDocuments
   Set doc = checkdc.GetFirstDocument
   
   Do While Not doc Is Nothing   
      
      found = False
      
      'Prüfe Nachname und Vorname
      Set dc = targetdb.Search( |Lastname = "| + doc.LastName(0) + |" & Firstname ="| + doc.FirstName(0) + |"|,Nothing,0 )
      
      If dc.Count > 0 Then
         'Msgbox(dc.count)
                 'Hier gibt es einen Treffer:            
         found = True
         Redim SucheName(dc.count)
         Redim Unids(dc.count)
         'Redim Abtei(dc.count)
         
         For i = 1 To dc.count
            Set tmpdoc = dc.getNthDocument(i)
            SucheName(i-1) =tmpdoc.LastName(0) & ", " + tmpdoc.FirstName(0)& " " & tmpdoc.CompanyName(0) & " (" & Format$( doc.LastModified, "Short Date") & ")" & "                                                                                            ~" & tmpdoc.UniversalID
            Unids(i-1) = tmpdoc.UniversalID
            'Abtei(i-1)=tmpdoc.Abteilung(0)
            
         Next
         
         doc.Ergebnis = SucheName
         doc.Liste1 = SucheName
         doc.Unids = Unids
         doc.Aktuell_= doc.Lastname(0)+ ", " + doc.FirstName(0)+ " " + doc.CompanyName(0)& " (" & Format$( doc.LastModified, "Short Date") & ")" & "                                                               ~" & doc.UniversalID
         doc.Aktuell =doc.Lastname(0)+ ", " + doc.FirstName(0)+ " " + doc.CompanyName(0)
         
         Flag = WS.Dialogbox("dialog", True, True, False, False, False, False, "Export", doc, False)
         
         
      Else
                   ' Kein Treffer: Dok. kann kopiert werden
         
         'abt = Inputbox$("Bitte zuständige Abteilung eingeben:", "Abteilung eingeben","-")
         Call doc.CopyTodatabase(targetdb)
         
         'Msgbox(abt)   
         'tmpdoc.Abteilung = abt
         'tmpdoc.Form = "Kontaktformular_"
         'doc.Type = "Kontaktformular_"
         'Call tmpdoc.Save(True, True)

         Set source= WS.CurrentDocument
         Msgbox("Das Dokument wurde in die Datenbank hinzugefügt")
         
      End If
      Set doc = checkdc.GetNextDocument(doc)
      
      Loop   'do while not doc is nothing
End Sub

klaussal:

--- Code: ---'doc.Type = "Kontaktformular_"

--- Ende Code ---
Das soll natürlich nicht passieren.
Das machst Du doch selber !?!

--- Code: ---'tmpdoc.Abteilung = abt

--- Ende Code ---
Das sollte es doch sein.

klaus

Selin:
<<Code:
'tmpdoc.Abteilung = abt

Das sollte es doch sein.

dann kommt das:

Object variable not set

klaussal:
An welcher Stelle, was sagt der Debugger ?

Driri:
Inputbox liefert einen Variant zurück.

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln