setChoiceLabel( )

計算ルールでこのヘルパー関数を使用して、既存の選択肢(ドロップダウン、ラジオ・ボタンまたはチェック・ボックス)に選択を追加します。

式は、ターゲット制御に戻される必要があり、clearChoice( )と組み合せて使用する必要がある文字列JSON値を作成します。

構文

setChoiceLabel(labelStr, variable)

パラメータ

labelStr

ラベル文字列。

変数

ルール・エディタからの選択変数。

戻り値

選択した選択ラベルの空のJSONオブジェクト文字列またはJSONオブジェクト配列文字列を返します。

例3-86計算ルールのターゲットとして"Allergies"および"Obesity"を含む複数のラベルを持つドロップダウン(選択)コントロールがある場合

// Select "Allergies"
if (someCondition) {
    return setChoiceLabel("Allergies");
} else {
    return clearChoice();
}
// selects "Allergies" in the calculated control
   
// Select "Allergies" and "Obesity"
var b;
if (someCondition) {
    b = setChoiceLabel("Allergies");
    return setChoiceLabel("Obesity", b);
} else {
    return clearChoice();
}
// selects "Allergies" and "Obesity" in the calculated control