Checkbox 如何在lotusscript中使用复选框列表?

Checkbox 如何在lotusscript中使用复选框列表?,checkbox,lotusscript,Checkbox,Lotusscript,我正在开发一个LotusNotes应用程序。我想知道如何从复选框列表中选中/取消选中和启用/禁用各个复选框选项。我就是这样做的,以某种方式检查它: Dim CheckListInitiator As String CheckListInitiator = doc.CheckListInitiator(0) ''get the checked items text in a variable. ''append the content of the required checkbox

我正在开发一个LotusNotes应用程序。我想知道如何从复选框列表中选中/取消选中和启用/禁用各个复选框选项。我就是这样做的,以某种方式检查它:

Dim CheckListInitiator As String
CheckListInitiator = doc.CheckListInitiator(0)      ''get the checked items text in a variable.

''append the content of the required checkbox to the list. This will check it.

If CheckListInitiator = "" Then     ''if nothing checked, means the list is empty.
    CheckListInitiator = "Allotment Approval attached"          
Else    ''the list has one or more options checked, so append the content.
    CheckListInitiator = CheckListInitiator + "; Allotment Approval attached"           
End If
我不确定这样做是否正确。此外,我仍然无法启用和禁用列表中的单个项目

有人能帮忙做这件事吗


谢谢

我会使用数组变量来保持简单。您需要创建的是一个多值字段,而不是一个包含分号的字符串

Dim checkListValues as Variant
  'turn this into a variant array
checkListValues = split("")
  'add the values currently selected and remove the blank
checkListValues = FullTrim(arrayappend(checkListValues, doc.CheckListInitiator))
  'add the value you want to add
checkListValues = ArrayAppend(checkListValues, "Allotment Approval attached")
  'return this list to the document
doc.CheckListInitiator = checkListValues
还有其他方法可以做到这一点,使用适当的数组等等,但对我来说,这是LotusScript中最简单的方法

它在@Formula语言中也非常简单

@Setfield("CheckListInitiator"; CheckListInitiator : "Allotment Approval attached")

您可以通过doc.getitemvalue[CheckBoxName]获取所选值。这将返回一个数组。 要设置复选框,只需执行doc.replaceItemvalue[CheckBoxName]、[CheckBoxValue]或doc.replaceItemvalue[CheckBoxName]、[checkBoxValues]即可同时设置多个值


复选框中可用的值在复选框属性的注释表单中定义

我就是这样做的,而且似乎很管用:

要选中相应的复选框:

要取消选中相应的复选框:


最后一点:我需要启用/禁用相应的复选框。我一点也不知道如何做到这一点。可能吗?

@D.Bugger完全正确。一个愚蠢的错误,可能是因为最近写了太多的公式语言。编辑并更正了有关如何禁用单个复选框的任何帮助?据我所知,您可以通过更改关键字来隐藏或显示单个复选框,但无法在Notes中启用/禁用单个复选框。
Dim checkListValues As Variant
'Turn this into a variant array
checkListValues = Split("") 

checkListValues = Fulltrim(Arrayappend(checkListValues, doc.GetItemValue("CheckListInitiator")))
checkListValues = Arrayappend(checkListValues, "Allotment Approval attached")

Call doc.ReplaceItemValue ("CheckListInitiator", checkListValues)
Call doc.Save(True, False)
Dim checkListValues As Variant
''Turn this into a variant array
checkListValues = Split("") 

''Build array from the checkbox list, then remove the respective array element to update the list.
checkListValues = Fulltrim(Arrayappend(checkListValues, doc.GetItemValue("CheckListInitiator")))    
checkListValues = Fulltrim(Replace(checkListValues, "Allotment Approval attached","")) 
Call doc.ReplaceItemValue ("CheckListInitiator", checkListValues)
Call doc.Save(True, False)