按钮单击事件 - Lotus 脚本
我想要用于按钮单击事件的正确 Lotus 脚本,单击时会弹出工作人员的关键字列表以选择并放置在上级 1 字段上...我不确定要给出的参数...请帮助我.. 。我按照下面的脚本操作,但它不起作用...它显示在一个空的对话框列表中...:(...或者为我提供一个替代公式或总和来解决这个问题...非常感谢...
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
非常感谢 Hristo 和 mbonaci...:) 我已经用 pickliststrings 搞定了,我已经得到了我想要的,即显示按组列分类的 super1 关键字列表...下面是我使用的脚本...
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
现在,从列表中选择任何关键字...例如:“Executive”应该放置在当前文档/表单的“Superior1”字段中...wazz 这个脚本...请帮助我...
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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如所写,
PickListStrings
应该会导致错误,因为第七个位置缺少参数 -prompt$
(PickListStrings 帮助) Notes 不需要数字(在本例中为 4)作为参数。除此之外:
Superior1
(您测试的值)中输入字符串以确保存在这样的类别?如果视图中存在该类别,焦点应移至该类别。Sup1$
以确保它包含预期值。不会造成问题,但请记住:
Dim view,view1 As NotesView
声明了Variant
类型的变量view
和view1
。将它们放在不同的行上以避免出现意外行为的可能性。例如,这里的语句NotesView
类型的If (view is Nothing) Then
将导致“类型不匹配”错误。If Superior1= "" Then
中的变量Superior1
似乎是值为 EMPTY 的变体,因此条件始终为 true。使用 Option Declare 是一种很好的做法,可以防止编译。As written, the
PickListStrings
should result in an error, because there is a missing argument on the seventh position - theprompt$
(help for PickListStrings) and Notes does not expect a number (4 in this case) as an argument.Other than that:
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.Sup1$
in the status bar to make sure it contains the expected value.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.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.为什么不简单地使用带有 @DbColumn 公式的对话框列表字段作为选择(字段属性的第二个选项卡):
示例:
将返回当前数据库的“x_asean_search”视图的第四列中的所有值。
详细信息在这里:
http:// /publib.boulder.ibm.com/infocenter/domhelp/v8r0/topic/com.ibm.designer.domino.main.doc/H_DBCOLUMN_NOTES_DATABASES.html
Why don't you simply use Dialog list field with @DbColumn formula, as choices (second tab of field properties):
Example:
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