2017-06-16 57 views
1

LotusScriptを使用してListBoxで値を選択しようとしています。 私のコードは次のようになります:ロータススクリプト - 複数選択リストボックスで複数の値をプログラムで選択する方法

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 

しかし、動作しません。私は最初の項目を選択しようとしても問題はありませんが、複数項目を選択することはできません。ロータススクリプトを使用して、リストボックスの項目を選択する方法

1: enter image description here

質問:

マイリストボックスには、次の2つのアイテムを(それが将来的にそれらの多くになります)がありますか?

2.項目が二つ以上のe.t.c.で数えるかどうかはどのように、選択するために、どの項目を選択することができますか?

3.このいくつかの小さな例または任意のアドバイスをお願いすることができます...

ありがとうございました!

答えて

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 

フォームに私がそのフィールドを埋める値[A、B、C]を1つのボタンでのみ1フィールドListFieldをを有するクリーンな例です。

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) 

Немазащо。

+0

ありがとうございます!あなたのソリューションは完璧に動作します! Спасибо! :) –

関連する問題