I have noticed when I trigger an agent “On Event” I have the option to run the event on “All Documents In View” but when I trigger an agent “On Schedule” the “All Documents In View” is not an option. I need to be able to trigger an agent “On Schedule” that copies all the documents in a certain view at that time into a different database. The view is a very complex one and selects exactly the records I want to copy. Is there not a way around this?
Subject: Question On Agent Trigger
Not completely sure, but putting Select Form=“test” & status=“Deleted” should limit the documents to those which match the formula. Test before using ![]()
Otherwise it’s easier to do it in LotusScript:
Dim session as new NotesSession
Dim thisdb As NotesDatabase
Dim targetdb As New NotesDatabase(“”, “projects2.nsf” )
Dim view As NotesView
Dim doc As NotesDocument
Set thisdb=session.CurrentDatabase
Set view = thisdb.GetView( “Closed Issues” )
Set doc = view.GetFirstDocument
While Not ( doc Is Nothing )
Call doc.CopyToDatabase( targetdb )
Set doc = view.GetNextDocument( doc )
Wend
Subject: Question On Agent Trigger
Do you use LotusScript or Formulas? With Script you can use NotesView with GetFirstDocument and GetNextDocument to get all documents from a view.
Subject: RE: Question On Agent Trigger
Henrik - I normally use formulas.
Subject: RE: Question On Agent Trigger
Time to find a new normal, then. You do realize that you can create a search for your formula agent, though, or use a SELECT statement right in the agent. That will work for views, but if you ever need to do the same thing with a folder, you’ll absolutely have to use LotusScript (or Java, if you prefer).
Subject: RE: Question On Agent Trigger
Stan - Thanks for your response. I had tried using a search in my formula agent and can easily select the correct “parent” documents I need. What I have not been able to do is also pull in the child documents using @alldescendants that I also need. I can’t pull in the child documents using the search in the formula like I did for the parent documents because the child documents don’t carry all the fields that are required to satisfy the search.
The idea situation would be to select the parent documents though a serach in the formula agent but it also process all the related child documents.
Subject: Question On Agent Trigger
In script you can use the…AllEntries method of the notes view class to get a notesviewentry collection.
Or you can get a document collection without a view by using db.search().