Subject: how do I populate a list box with all views from an external db
I’m not certain how to populate the fields available, as I’m not sure exactly what you mean by that. But I do have a database that does everything up to that point - users get a dropdown of servers to choose from, then when they choose the server, they get another dropdown of databases, then a dropdown of views in the database.
This is kind of messy to explain, but I’ll try. If you want me to send you the database itself, leave your email address.
Form contains four fields: serverChoice, dbChoice, viewList, and viewChoice.
serverChoice properties:
Combobox
Use formula for choices
Formula:
@DbColumn(“”;“myservername”:“names.nsf”;“Servers”;3)
Refresh fields on keyword change
Refresh choices on document refresh
dbChoice properties:
Dialog list (although could be combobox - just did this because of space constraints)
Allow multiple values
Use formula for choices
Formula:
@DbLookup( “” : “NoCache” ; serverChoice : “catalog.nsf” ; “ByServer” ; serverChoice ; 3 ) + " | " + @DbLookup( “” : “NoCache” ; serverChoice : “catalog.nsf” ; “ByServer” ; serverChoice ; 2 )
Refresh fields on keyword change
Refresh choices on document refresh
Hide-when: serverChoice=“”
onChange:
Sub Onchange(Source As Field)
On Error Goto errhand
Dim w As New notesuiworkspace
Dim uid As notesuidocument
Dim thisDoc As notesdocument
Dim chosenDB As notesdatabase
Dim viewList As notesitem
Set uid = w.currentdocument
Set thisDoc = uid.document
Set viewList = thisDoc.getfirstitem("viewList")
Set chosenDB = New NotesDatabase( "", "")
Call chosenDB.open(thisdoc.serverChoice(0), thisdoc.dbChoice(0) )
Forall v In chosenDB.views
Call viewList.appendToTextList(v.Name)
End Forall
Call uid.Refresh
Exit Sub
errhand:
Msgbox "onchange error at line " & Erl & ": " & Error
Exit Sub
End Sub
viewList properties:
Text, multivalue
Computed
Compute after validation
Default formula: viewList
Hide-when: 1 (or however you indicate hide always)
viewChoice properties:
Dialog list
Use formula for choices
Formula:
viewList
hide-when: dbChoice=“” & viewList=“”