问题
I want proper lotus script for button click event that on click pops out a keyword list of staff to select and place on the superior1 field... I am not sure of the parameters to be given... please help me with that... I followed the below script and it didnt work... it is showin an empty dialog list...:(... or else provide me an alternative formula or sumthin to work this out... thx a lot...
Sub Click(Source As Button)
Dim session As New notessession
Dim view,view1 As NotesView
Dim doc,doc1 As notesdocument
Dim db As Notesdatabase
Set db=session.CurrentDatabase
Dim Overdb As notesdatabase
Set Overdb=session.GetDatabase(db.server, "Master\\ASEAN_Staff.nsf")
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim picklist As Variant
Set uidoc = workspace.CurrentDocument
If Superior1= "" Then
Sup1$ = uidoc.FieldGetText("Superior1")
picklist = workspace.PickListStrings( PICKLIST_CUSTOM,_
False,_
db.server,_
"Master\\ASEAN_Staff.nsf",_
"x_asean_search",_
"Select Name",_
4,_
Sup1$ )
End If
End Sub
Thx a lot Hristo & mbonaci...:) I've wrked out with the pickliststrings and i've got wat i wanted i.e to display a list of superior1 keywords categorized by group column... foll is the script tat i used ...
Sub Click(Source As Button)
Dim session As New notessession
Dim view As NotesView
Dim view1 As notesview
Dim doc,doc1 As notesdocument
Dim db As Notesdatabase
Set db=session.CurrentDatabase
Dim Overdb As notesdatabase
Set Overdb=session.GetDatabase(gsserver, gspath + "Master\\ASEAN_Staff.nsf")
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim picklist As Variant
Set uidoc = workspace.CurrentDocument
If Superior1= "" Then
'Sup1 = uidoc.FieldGetText("Superior1")
'Ofc = uidoc.FieldGetText("Office")
Gp = uidoc.FieldGetText("Group")
'og = doc.Office + doc.Group
picklist = workspace.PickListStrings( PICKLIST_CUSTOM,_
False,_
gsserver,_
"Master\\ASEAN_Staff.nsf",_
"x_asean_search",_
"Select Name",_
"Choose",_
1,_
Gp )
End If
End Sub
Now, on selectin any keyword from the list... for eg: "Executive" shud be placed on the field "Superior1" of the current document/form... wazz the script for this... plz help me...
回答1:
As written, the PickListStrings
should result in an error, because there is a missing argument on the seventh position - the prompt$
(help for PickListStrings) and Notes does not expect a number (4 in this case) as an argument.
Other than that:
- Have you tried opening the target view ("x_asean_search" in "Master\ASEAN_Staff.nsf") and typing the string from field
Superior1
(the value you test with) to make sure there is such category? The focus should move to that category, if it exists in the view. - Try printing the
Sup1$
in the status bar to make sure it contains the expected value. - Is the fourth column of the view the one, which values you want to return?
Not causing a problem, but good to keep in mind:
Dim view,view1 As NotesView
declares variableview
of typeVariant
andview1
of typeNotesView
. Put them on separate lines to avoid the possibility of unexpected behavior. For example, here a statementIf (view is Nothing) Then
will result in a "Type Mismatch" error.- The variable
Superior1
fromIf Superior1= "" Then
seems to be a variant with value EMPTY, so the condition is always true. UsingOption Declare
is a good practice that would prevent this from compiling.
回答2:
Why don't you simply use Dialog list field with @DbColumn formula, as choices (second tab of field properties):
@DbColumn( class : cache ; server : database ; view ; columnNumber )
Example:
@DbColumn( "ReCache"; ""; "x_asean_search"; 4 )
will return all values from the fourth column of the "x_asean_search" view of the current database.
Details here: http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/topic/com.ibm.designer.domino.main.doc/H_DBCOLUMN_NOTES_DATABASES.html
来源:https://stackoverflow.com/questions/5162450/button-click-event-lotus-script