Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Agent not working, but it works if the code is in a form

Status
Not open for further replies.

AntunB

IS-IT--Management
Aug 11, 2003
263
0
0
AU
ok i want an agent that will search a view and put all the entries into an array

Code:
Sub Initialize

Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim arrName() As String
Dim i As Integer

Set db = session.CurrentDatabase
Set view = db.getView( "PCandLaptops" )
Set doc = view.GetFirstDocument()
i = 0

Do Until doc Is Nothing
Redim Preserve arrName(i) As String
arrName(i) = doc.getItemValue( "ComputerName_1" )(0)
Set doc = view.GetNextDocument(doc)
i = i + 1
Loop

End Sub

Agent properties

Name: Test
When should this agent run? Manualy from agent list
Which documents should it act on? Run Once


when it runs it says it finished successfuly, but there are no entries


if i put the same code into a form Action it works fine

how would i fix it to work in the agent?

thanks
 
I would run it on All Docs in Database.
That particular selection is of no consequence, since your code has to control what documents it wants to work on.
All script agents should be set to run on All Docs, so as to ensure that they will run correctly. Any other choice is really only valid for Formula agents.

Pascal.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top