Hallo,
über die Database Script möchte ich über LotusScript einen Agenten aufrufen.
Über Formula klappt das wunderbar. Da ich aber mehr Funktionen einfügen möchte, bin ich gezwungen LotusScript zu verwenden.
Allerdings bekomme ich jedes mal, wenn der Interpreter versucht den Agenten auszuführen, folgende Fehlermeldung:
Notes error: Unsupported trigger and search in the beackground or embedded agent => QueryDocumentDelete 10
Hier mein Code:
Sub Querydocumentdelete(Source As Notesuidatabase, Continue As Variant)
On Error Goto EH
Dim s As New NotesSession
Dim db As NotesDatabase
Dim agent As NotesAgent
Set db = s.CurrentDatabase
Set agent = db.GetAgent("delete_selected")
Call agent.Run
PE: Exit Sub
EH: Call raiseError("", Err, Error$, Erl)
End Sub
Liebe Grüße
Giordano
Mal so als Anregung:
This view action deselects all documents in the current view.
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uiview As NotesUIView
Set uiview = ws.CurrentView
Call uiview.DeselectAll
End Sub
Mal so als Anregung:
This view action deselects all documents in the current view.
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uiview As NotesUIView
Set uiview = ws.CurrentView
Call uiview.DeselectAll
End Sub
Hi klauss,
soweit ich weiss gibt es einen Unterschied zwischen dem Deselectieren der Häckchen (was obiges macht) und dem rückgängig machen der zum löschen markierten Dokumenten.
@Bernhard:
Bei einer Funktion komme ich ja um das Continue-Problem auch nicht herum.
Seltsamerweise funktioniert auch nicht der Code, wenn ich ihn in eine Library kopiere:
Function deleteSelected()
On Error Goto EH
Dim continue As Variant
Dim nuiw As New NotesUIWorkspace
Dim yes_Cancel As Integer
Dim uiview As NotesUIView
Set uiview = nuiw.CurrentView
'Msgbox lsf.CurrentDB.AllUnprocessedDataRecords.lSize
If uiview.ViewName = "Papierkorb" Or uiview.ViewName = "MitarbeiterListe"Then
yes_Cancel = Messagebox("Achtung! Dies löscht unwiederruflich die Daten!", 3 + 48, "ACHTUNG!")
If yes_Cancel = 6 Then 'Ja
'Dim nuiw As New NotesUIWorkspace
Dim ns As New NotesSession
Dim db As NotesDatabase
Set db = ns.CurrentDatabase
Dim dc As NotesDocumentCollection
Dim nextdoc As NotesDocument
Dim doc As NotesDocument
Set dc = db.UnprocessedDocuments ' Markierte View-Einträge! :-)
Set doc = dc.GetFirstDocument
Do While Not (doc Is Nothing)
Set nextdoc = dc.GetNextDocument(doc)
Call doc.RemovePermanently(True)
Set doc = nextdoc
Loop
Call nuiw.ViewRefresh
%REM
Dim itUnprocessed As GISNCIterator
Dim dr As GISNotesDataRecord
Set itUnprocessed = lsf.CurrentDB.AllUnprocessedDataRecords
While itUnprocessed.hasNextElement
Set dr = itUnprocessed.nextElement
Call dr.nd.Remove(True)
Wend
%END REM
Else
Continue = False
End If
Call nuiw.ViewRefresh
End If
PE: Exit Function
EH: Call raiseError("", Err, Error$, Erl)
End Function
Die Abfrage wird zwar ausgeführt, aber die Dokumente werden nicht gelöscht, wenn man auf "Ja" klickt. Es tut sich nichts. Es kommt nicht mal eine Fehlermeldung. Die Löschmarkierung wird jedoch vorgenommen (was ja ok ist).
Liebe Grüße
Giordano
Im Moment stehe ich etwas auf dem Schlauch. Was ist denn aus deinem Agenten geworden?
Oder ist die Funktion der Ersatz für den Agenten?
Wo und wie rufst du denn die Funktion auf? Zeig' mal ein bisschen Code.
Also ganz grob würde ich das so lösen:
Sub QueryDocumentDelete(Source As NotesUIDatabase, Continue As Boolean)
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim tmpdoc As NotesDocument
Set collection = Source.Documents 'Alle markierten Dokumente
If collection.Count = 0 Then Exit Sub
If Messagebox("Achtung! Dies löscht unwiederruflich die Daten!", 3 + 48, "ACHTUNG!") = 6 Then
Set doc = dc.GetFirstDocument
While Not (doc Is Nothing)
Set tmpdoc = collection.GetNextDocument(doc)
Call doc.Remove(True)
Set doc = tmpdoc
Wend
End If
End Sub
Axel