Domino 9 und frühere Versionen > Entwicklung

$UpdatedBy letzter Bearbeiter außer bestimmter

(1/2) > >>

MrMagoo:
Hallo zusammen,
folgendes Problem: Ich lese mit folgendem Agenten den ersteller des Dokumentes aus

Sub Initialize
   Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim collection As NotesDocumentCollection
   Dim doc As NotesDocument
   Dim subj As Variant
   
   Set db = session.CurrentDatabase
   Set collection = db.unprocessedDocuments
   Set doc = collection.GetFirstDocument
   While Not (doc Is Nothing)
      subj = doc.GetItemValue("$UpdatedBy")
      Messagebox( subj( 0 ) )
      Set doc = collection.GetNextDocument(doc)
   Wend
End Sub

Jetzt möchte ich aber den letzten Bearbeiter haben, außer es war ein bestimmter z.B. der Server.  ???
Kann mir jemand helfen, danke

Markus Henke:

--- Zitat von: MrMagoo am 15.10.03 - 11:31:28 ---Hallo zusammen,
folgendes Problem: Ich lese mit folgendem Agenten den ersteller des Dokumentes aus

Sub Initialize
   Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim collection As NotesDocumentCollection
   Dim doc As NotesDocument
   Dim subj As Variant
   
   Set db = session.CurrentDatabase
   Set collection = db.unprocessedDocuments
   Set doc = collection.GetFirstDocument
   While Not (doc Is Nothing)
      subj = doc.GetItemValue("$UpdatedBy")
      Messagebox( subj( 0 ) )
      Set doc = collection.GetNextDocument(doc)
   Wend
End Sub

--- Ende Zitat ---

Versuch mal folgendes:

.....
subj = doc.GetItemValue("$UpdatedBy")
Forall s In subj
If s <> server Then
msgBox(s)
End If
End Forall
Set doc = collection.GetNextDocument(doc)
.....

koehlerbv:
Das kommt aber wieder auf's selbe 'raus wie der erste Code.

Die Schleife muß rückwärts durchlaufen werden und beim ersten Auftreten eines Nicht-Servers verlassen werden, also ein
For iLoop = ubound (<UpdatedBy-Array>) to 0 step - 1

Und der / die Servernamen müssen bekannt sein oder einem eindeutigen Schema entsprechen.

HTH,
Bernhard

Markus Henke:
Da hast Du allerdings recht.  ;)

MrMagoo:
Also ich weiss nun zwar nicht warum, aber so macht er  es richtig

While Not (doc Is Nothing)
      subj = doc.GetItemValue("$UpdatedBy")
      Forall s In subj
         If s <> "server1" Then
            Set item = doc.ReplaceItemValue( "anzeige", s)
            Call doc.Save( True, True )
         End If
      End Forall

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln