Domino 9 und frühere Versionen > ND7: Entwicklung

Problem mit einem Script

(1/4) > >>

ewald:
Hallo zusammen,
bei dem folgend Script krieg ich immer den Fehler "Object variable not set", und zwar denke ich bei der Zeile Call uidoc.FieldSetText..........
Der Fehler ist wahrscheinlich recht enifach aaber ich bin nicht so der Script-Experte :-(
Das Script steht in einem Button einer View. Dort werden Dokumente selektiert. Und bei diesen wird dann ein Wert in ein Feld geschrieben, den ich aus einem anderen Dokument hole.

Sub Click(Source As Button)
   
   Dim ws As New NotesUIWorkspace   
   Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim uiview As NotesUIView
   Dim collection As NotesDocumentCollection
   Dim uidoc As NotesUIDocument   
   Dim doc As NotesDocument   
   Dim j As Integer   
   
   Set db = session.CurrentDatabase
   Set collection = db.UnprocessedDocuments
   Set uidoc = ws.currentdocument   
   Set doc = ws.currentdocument.document      
   Set uiview = ws.CurrentView   
   
   Dim tmpSEAStartDate As String
   
   ' The profile document
   Dim profDoc As NotesDocument
   Set profDoc = db.GetProfileDocument("MainProfile")   
   
   tmpSEAStartDate = profDoc.dlgSEAStartDate(0)   
   Msgbox tmpSEAStartDate
   
   For j = 1 To collection.Count
      Set doc = collection.GetNthDocument( j )
      
      Call uidoc.FieldSetText("SEAStartDate", tmpSEAStartDate)      
      
      Call doc.Save( False, True )
   Next
   
   ' Remove all the selections
   Call uiview.DeselectAll
   
End Sub

Vielen Dank.

Grüsse Ewald

eknori:

--- Zitat ---Button einer View
--- Ende Zitat ---

uidoc ist doch das gerade geöffnete Dokument !!

Du wendest Frontendmethoden im Backend an.

ewald:
Ulrich, danke für die schnelle Antwort, aber was muss ich denn nun eigentlich tun?

eknori:
du willst doch sichr im DOC ein feld neu besetzen, oder ? Dann ist die Methode ReplaceItemValue dein Freund

also entweder

Dim item As NotesItem
'
Set item = doc.ReplaceItemValue( "SEAStartDate", tmpSEAStartDate )

oder

doc.SEAStartDate = tmpSEAStartDate

ewald:
Habs geändert in

Call doc.ReplaceItemValue("SEAStartDate", tmpSEAStartDate)

der Fehler kommt aber immer noch :-(

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln