Domino 9 und frühere Versionen > Entwicklung

Auslesen Feld N/A-book und in gemeinsames Feld schreiben

(1/2) > >>

Marshuhn:
Hallo Notesgurus,

ich habe erneut eine Frage:

Ich möchte aus unserem Namens- und Adressbuch für den jeweils angemeldeten Anwender ein Feld (Vertreter) auslesen lassen. Dieses soll alles über ein gemeinsames Feld erfolgen. Das gemeinsame Feld lautet HugoErna und soll auch selber gefüllt werden und dann in der Maske gefüllt angezeigt werden.

Ich verwende dafür folgendes Script:

Sub Initialize
   Dim workspace As New NotesUIWorkspace
   Dim session As New NotesSession
   Dim books As Variant
   Dim view As NotesView
   Dim doc As NotesDocument
   Dim actdoc As notesdocument   
   Dim item As notesitem
   Dim done As Variant
   Dim person As String
   Dim test As Variant
   Dim Stellvertreter As Variant
   Dim person1 As Variant
   books = session.AddressBooks
   done = False   
   Set uidoc =   workspace.currentdocument   
   Set actdoc =uidoc.document
   person1 = Evaluate(|@Name([Abbreviate];@UserName)|)
   person = person1(0)
   Forall b In books
    ' check every Domino Directory,
    ' unless we're already done
      If ( b.IsPublicAddressBook ) And ( Not done ) Then
         Call b.Open( "", "" )
      ' look up person's last name
      ' in People view of address book
         Set view = b.GetView( "($VIMPeople)" )
         Set doc = view.GetDocumentByKey( person )
      ' if person is found, display the phone number item
      ' from the Person document
         If Not ( doc Is Nothing ) Then
            done = True
            If doc.Stellvertreter(0)="" Then
               Msgbox "Feld Stellvertreter ist nicht gefüllt"
               Msgbox doc.Stellvertreter(0)
            Else
               Msgbox "Feld Stellvertreter ist gefüllt"
               Msgbox doc.Stellvertreter(0)
'               Call uidoc.fieldsettext("HugoErna","Hallo")
               Set item = actdoc.replaceitemvalue("HugoErna",doc.Stellvertreter(0))            
               Msgbox actdoc.HugoErna(0)
               uidoc.refresh
            End If
         Else
            Msgbox "nicht gefunden"
         End If
      End If
   End Forall
  ' if done is still False, the person wasn't found
   If Not done Then
      Messagebox _
      ( "Sorry, unable to locate person's name." )
   End If
End Sub


Leider wird der Wert nur sehr kurz eingeblendet. Danach verschwindet der Wert wieder. Wenn ich die auskommentierte Zeile
(Call uidoc.fieldsettext("HugoErna","Hallo")
durchführen lasse, dann bekomme ich die Fehlermeldung "Notes Fehler #0c:04).

Vielen Dank schon einmal vorab für die Hilfe.  :D

Danke

Glombi:
Statt uidoc.refresh würde ich ein
call uidoc.Reload
machen. Die Zeile
Call uidoc.fieldsettext("HugoErna","Hallo")
löschen bzw weiterhin auskommentieren, da Du das im Backend setzen solltest.

Andreas

koehlerbv:
Das sieht mir eher nach was anderem aus: Was steht denn als Formel in Deinem berechneten Feld HugoErna ? Vielleicht "" ?

Bernhard

PS:  Statt uidoc.Refresh kannst Du auch NotesUIWorkspace.ViewRefresh nehmen.

Marshuhn:
Hallo Ihr Beiden,

wieder einmal schon danke für die Unterstützung.

Das Feld, welches ich füllen lassen will ist ja das gemeinsame Feld. Die oben beschriebene Formel steht im Initialize. Sonst ist keine weitere Formel in diesem gemeinsamen Feld vorhanden. Leider haben mir Eure Voschläge noch keinen Erfolg gebracht.  :'(

Gruß + danke für hoffentlich weitere Hilfe

Marshuhn

Glombi:
In welchem "Initialize" ?
Wenn ich den Code in das Initialize eines gemeinsamen Feldes einfüge, bekomme ich beim Erstellen eines Dokument hier einen Fehler:
Set uidoc =   workspace.currentdocument  

"Object variable not set"

Also, wo genau ist der Code?

Andreas

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln