Generate name/value pairs in Domino with a small amount of code. Concatenate Evaluate statements in a WebQueryOpen agent and have a short formula in the field that will contain the select options. The value (not the label) is passed when the form is submitted.
The HTML for the field that is generated by Domino will look like:
<OPTION VALUE="1">Briefing Material <OPTION VALUE="2">Memorandum
instead of the list being generated without values and the whole thing being selected by default, which will happen if you just insert a list into the field:
<OPTION SELECTED>Briefing Material <OPTION SELECTED>Memorandum
WebQueryOpen Agent:
Dim session As New notessession Dim db As notesdatabase Dim doc As notesdocument Dim tempDoc As NotesDocument Dim nameValuePair() As String Dim x As Integer Set db = session.CurrentDatabase Set doc=session.DocumentContext Set tempDoc = session.CurrentDatabase.CreateDocument ' The type of @DbLookup/Column is irrelevant tempDoc.ValueList = Evaluate ( {@DbColumn("ODBC" : "NoCache" ; "dbname" ; "userid" ; "password" ; "DocType" ; "Doc_Value" : "Discard" ; "Distinct" : "Ascending")}, tempDoc) tempDoc.LabelList = Evaluate ( {@DbColumn("ODBC" : "NoCache" ; "dbname" ; "userid" ; "password" ; "DocType" ; "Doc_Label" : "Discard" ; "Distinct" : "Ascending")}, tempDoc) x = -1 Forall i In tempDoc.ValueList x = x+ 1 Redim Preserve
Requires Free Membership to View
Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.
nameValuePair(x) ' Concatenate the input value and input label with pipe character | nameValuePair(x) = tempDoc.LabelList(x) & "|" & tempDoc.ValueList(x) End Forall Call tempDoc.RemoveItem ("ValueList") ' no need to keep the temporary field Call tempDoc.RemoveItem ("LabelList") ' no need to keep the temporary field doc.selectList = nameValuePair() 'insert the concatenated list into the field on the HTML form End Sub
The field on the form (selectList) is an editable dialog list. It uses a formula for choices:
" " + selectList
This was first published in August 2001