I have a dialog list field that allows mutliple values. I want to run an agent that will print out these values separately in the status bar. Here is what I have so far.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
choices = uidoc.FieldGetText( “textnetworktype” )
array = choices.Values
Forall words In array
Print "Choices: " + words
End Forall
End Sub
textnetworktype = dialog list field
I keep getting a script error that says “Illegal reference to array or list: ARRAY”. Any suggestions?
FYI - I think I need to use the StrToken function; however, help doesn’t explain that function as well enough for me to understand it so if you are suggesting I use that function, please give an example.
Subject: Dialog List field
You can’t use values on a string, which is what fieldgettext returns. Instead get the background doc first and use a notesitem:
dim thisdoc as notesdocument
set thisdoc = uidoc.document
dim item as notesitem
set item = thisdoc.getfirstitem(“textnetworktype”)
forall words in item.values
etc.
Dan
Subject: Here’s an example…maybe it’ll help!
It builds a new document for each item in the list, so you’ll need to change the code.
Also, increase the array size.
Dim s As New notessession
Dim db As notesdatabase
Dim doc, doc1 As notesdocument
Dim view As notesview
Dim item As notesitem
Dim num As Variant
Dim People(1 To 5) As Variant
Dim i As Integer
Set db = s.currentdatabase
Set view = db.getview ("Shared")
Set doc = view.getfirstdocument
i = 0
Forall v In doc.getitemvalue("MV")
'Messagebox (v)
i = i + 1
People (i) = v
'Messagebox People(i)
End Forall
For x = 1 To i
Set doc1 = db.createdocument
doc1.form = "PeopleResponse"
doc1.People = People(x)
'Messagebox Cstr(doc.People)
Call doc1.save (True, True)
Next