setChoiceValue( )
在计算的规则中使用此帮助程序函数将值添加到现有选项(下拉列表、单选按钮或复选框)。
表达式将创建一个字符串 JSON 值,该值必须返回到目标控件,并且必须与 clearChoice( ) 结合使用。
语法
setChoiceValue(valueStr, variable)返回值
返回空的 JSON 对象字符串或所选选项值的 JSON 对象数组字符串。
示例 3-87 给定具有多个标签的下拉(选项)控件,其中分别包含 "Allergies" 和 "Obesity",值分别为 "4" 和 "45" 作为计算规则的目标
// Select label "Allergies" having value "4"
if (someCondition) {
return setChoiceValue("4");
} else {
return clearChoice();
}
// selects "Allergies" in the calculated control
// Select "Allergies" having value "4" and "Obesity" having value "32"
var b;
if (someCondition) {
b = setChoiceValue("4");
return setChoiceValue("32", b);
} else {
return clearChoice();
}
// selects "Allergies" and "Obesity" in the calculated control父主题:多个选项问题函数