Domino 9 und frühere Versionen > ND6: Entwicklung

Antwortdokumente und Leser und Autorenfelder

<< < (4/11) > >>

pete_bla:
Hi,

zu "Fehlermeldung: Object variable not set" fällt mir zuerst ein:
für Fehler immer gut:  Thema: Best Practices: Error Handling in Lotus Script
 (zumindest fürs Entwickeln mit Ausgabe) wie  z.B.:

--- Code: ---Sub blablabla
  on error goto hell
  ' ----------------
  ' dein code hier
  ' ----------------

  exit sub ' function 'oderwasauchimmer
hell:
  print {error #} & Cstr(err()) & { } & error() & { in line } & { } &  Cstr(erl())
  exit sub ' function 'oderwasauchimmer
End sub ' function 'oderwasauchimmer

--- Ende Code ---
 
ausserdem muss das

--- Code: ---Set parent = db.GetDocumentByID(respdoc.ParentDocumentUNID)
--- Ende Code ---
so lauten:

--- Code: ---Set parent = db.GetDocumentByUNid(respdoc.ParentDocumentUNID)
--- Ende Code ---
verwechsle NoteID (NotesDocument.NoteID) und
UNID (@DocumentUniqueID / NotesDocument.UniversalID) nicht!
und ich denk dass es bei

--- Code: ---Set dc = parent.Responses
--- Ende Code ---
oder dem call dc.stampall knallt.

darum zuvor noch eine Abfrage ob du überhaupt eine NotesDocumentCollection hast

--- Code: ---if dc.count > 0 then
    Call dc.StampAll( "leser_response" , parent.leser_response(0) )
end if
--- Ende Code ---
(wobei eine da sein muss, da du ja aus einem Antwortdokument kommst - ist dennoch besser!)

Grüsse, Pete(r)

cash:
jetzt kommt die Fehlermeldung:

error #91 Objectveriable not set in line 18

und line 18 wäre dann genau die geänderte Zeile:

Set parent = db.GetDocumentByUNid(respdoc.ParentDocumentUNID)

Gruß

Thomas

koehlerbv:
Und wo instantiierst Du respdoc? Damit muss ja 'Object variable not set' kommen.

Wenn ich das richtig verstehe, bist Du im QueryClose eines Antwortdokuments? Dann müsste die Zeile lauten:
Set parent = db.GetDocumentByUNid(Source.Document.ParentDocumentUNID)

Bernhard

cash:
ja mit der Zeile funktioniert es dann im queryclose...

aber ich muß das ja als scipt laufen lassen und im queryclos muß der Script ausgeführt werden...

Im Script habe ich nun die folgenden Zeile

Set parent = db.GetDocumentByUNidSource.Document.ParentDocumentUNID)

gegen diese beiden ausgetauscht:

Set agent = session.CurrentAgent
Set parent = db.GetDocumentByID(agent.ParameterDocID)
   


Es kommt folgende Fehlermeldung:

Notes error: Im Hintergrund ausgeführter oder eingebeteter Agent verwendet einen nicht unterstützen Auslöser und Suchtyp

Gruß

Thomas


Im Querclose steht jetzt:

Sub Queryclose(Source As Notesuidocument, Continue As Variant)
   
   Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim doc As NotesDocument
   Dim agent As NotesAgent
   
   Set db = session.CurrentDatabase
   Set doc = db.GetDocumentByUNid(Source.Document.ParentDocumentUNID)
   Set agent = db.GetAgent("Agent_Leser")
   
   Call agent.RunOnServer(doc.NoteID)
   
   
End Sub






So sieht jeztt der Script aus:

Sub Initialize
   
   On Error Goto hell
   
   
   Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim dc As NotesDocumentCollection
   Dim agent As NotesAgent
   Dim respdoc As NotesDocument
   Dim parent As NotesDocument
   
   Set db = session.CurrentDatabase
   
   Set agent = session.CurrentAgent
   Set parent = db.GetDocumentByID(agent.ParameterDocID)
   'Set parent = db.GetDocumentByUNid(Source.Document.ParentDocumentUNID) ´wenn der Script im Queryclose ist
   
   Set dc = parent.Responses
   
   If dc.count > 0 Then
      Call dc.StampAll( "leser_response" , parent.leser_response )
   End If
   
   
   Exit Sub
hell:
   Print {error #} & Cstr(Err()) & { } & Error() & { in line } & { } &  Cstr(Erl())
   Exit Sub
   
End Sub

cash:
habe nun noch mehr probiert aber komme einfach nicht weiter?

Was will mir die Fehlermeldung sagen? Bzw. wo könnte jetzt noch der Fehler liegen?

Gruß

Thomas

Navigation

[0] Themen-Index

[#] Nächste Seite

[*] Vorherige Sete

Zur normalen Ansicht wechseln