LotusScript - 如何以编程方式 select multi-select ListBox 中的多个值

LotusScript - How to select multiple values in multi-select ListBox programmatically

我正在尝试使用 LotusScript 在我的 ListBox 中 select 值。 我的代码如下所示:

Forall role In docByUi.rolesList
        If entity.getRoles <> "" Then
            If Instr(1, entity.getRoles,role,5) Then
                resultRoles = resultRoles & role
            Else    
                resultRoles = resultRoles + Chr$(13) + Chr$(10)
            End If
        End If
    End Forall

    Call uiDoc.FieldSetText("rolesList", resultRoles)
    Call uiDoc.Refresh

但它不起作用。当我尝试 select 第一项时没有问题,但我不能 select 超过一个。

我的列表框有两个项目(以后会更多):

问题:

1.如何使用 LotusScript select ListBox 项目?

2。如果项目数超过两个 e.t.c,我如何选择要 select 的项目?

3。能否请您举一些小例子或任何建议...

谢谢!

请将变量 [resultRoles] 声明为数组。

Dim resultRoles As Variant

resultRoles = Split("") 'that will make variable array

Forall role In docByUi.rolesList
    If entity.getRoles <> "" Then
        If Instr(1, entity.getRoles,role,5) Then
            resultRoles = Arrayappend(resultRoles, role)
        End If
    End If
End Forall

resultRoles = Fulltrim(resultRoles) 'that will delete first empty element from array

Call uiDoc.Document.replaceitemvalue("rolesList", resultRoles) 'use NotesDocument instead
Call uiDoc.Refresh

这是一个简洁的示例,其中在表单上我只有 1 个字段 ListField,其值为 [a、b、c] 和 1 个用于填充该字段的按钮。

Dim ws As New notesuiworkspace
Dim uidoc As NotesUIDocument
Dim a As Variant

Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document

a = Split("b;c", ";")
Call doc.replaceitemvalue("ListField", a)

你好。