按钮单击事件 - Lotus 脚本

发布于 2024-10-20 00:01:15 字数 1998 浏览 2 评论 0原文

我想要用于按钮单击事件的正确 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

¢好甜 2024-10-27 00:01:15

正如所写,PickListStrings 应该会导致错误,因为第七个位置缺少参数 - prompt$ (PickListStrings 帮助) Notes 不需要数字(在本例中为 4)作为参数。

除此之外:

  • 您是否尝试打开目标视图(“Master\ASEAN_Staff.nsf”中的“x_asean_search”)并从字段 Superior1 (您测试的值)中输入字符串以确保存在这样的类别?如果视图中存在该类别,焦点应移至该类别。
  • 尝试在状态栏中打印 Sup1$ 以确保它包含预期值。
  • 视图的第四列是您想要返回的值吗?

不会造成问题,但请记住:

  • Dim view,view1 As NotesView 声明了 Variant 类型的变量 viewview1 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 - 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 variable view of type Variant and view1 of type NotesView. Put them on separate lines to avoid the possibility of unexpected behavior. For example, here a statement If (view is Nothing) Then will result in a "Type Mismatch" error.
  • The variable Superior1 from If Superior1= "" Then seems to be a variant with value EMPTY, so the condition is always true. Using Option Declare is a good practice that would prevent this from compiling.
溺孤伤于心 2024-10-27 00:01:15

为什么不简单地使用带有 @DbColumn 公式的对话框列表字段作为选择(字段属性的第二个选项卡):

@DbColumn( class : cache ; server : database ; view ; columnNumber )

示例:

@DbColumn( "ReCache"; ""; "x_asean_search"; 4 )

将返回当前数据库的“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):

@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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文