Domino 9 und frühere Versionen > Entwicklung

NotesDoc als Rückgabewert eine Funktion

(1/3) > >>

tabama:
Hallo,

ich will mir aus einer Funktion ein NotesDocument als Rückgabewert übergeben lassen.

Die Funktion arbeitet auch richtig und ermittelt das von mir gewünschte Dokument.

Doch in der aufrufenden Procedur steht der Rückgabewert nicht zur Verfügung.

Ändere ich die Funktion und lasse mir einen String zurückgeben, funktioniert dies.

Lt. Handbuch kann eine Funktion aber auch Produktklassen zurückgeben.

Woran kann's liegen??? ???

koehlerbv:
Wie wär's mit ein wenig Code ?

koehlerbv:
Klopf, klopf, klopf ...

Problem erledigt ? Lösung selbst gefunden ? Sollen wir uns noch kümmern ? Dann brauchen wir aber ein Beispiel, welcher Code denn nun nicht das tut, was er tun soll (und NotesDocument als Rückgabewert ist nun mehr als üblich, ergo machbar).
Bernhard

Don Pasquale:
Dann springe ich mal ein, dieser Code ermittelt ein Doc
und soll dies zurückgeben.

In diesem Code bleibt lastdoc leer !

   Dim s As New NotesSession
   Dim db As NotesDatabase
   Dim dc As NotesDocumentCollection
   Dim doc As NotesDocument, pdoc As NotesDocument
   Dim lastdoc As NotesDocument
   Dim meinMailFile As String
   Dim meinName As NotesName
   Set meinName = s.CreateName(s.UserName)
   meinMailfile = getMailFile(meinName)
   Set lastdoc = getFirstMail( meinMailFile)


FUNKTION:


Function getLastMail(meineDB As String) As NotesDocument
   
   Dim s As New NotesSession
   Dim db As NotesDatabase
   Dim dc As NotesDocumentCollection
   Dim doc As NotesDocument, pdoc As NotesDocument
                Set db = s.database
   
   Set dc = db.AllDocuments
   Set doc = dc.GetLastDocument
   While Not(doc Is Nothing)
      
      If doc.HasItem("XYZ") Then
        If doc.GetItemValue("XYZ")(0) = "Form" Then
            Set pdoc = doc            End If
      End If
      Set doc = dc.GetNextDocument(doc)
   Wend
   Set getLastMail = pdoc
   
End Function

Driri:
Ist dir gerade langweilig oder warum antwortest Du auf nen mehr als 1 Jahre alten Thread ?  ;D

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln