clearValue( )
Use this helper function to clear values in a target populated by a calculation rule, whether it is a text, number, or multiple choice question.
To properly clear a rule target, this function needs to be used as the rule's return statement. See examples below.
Note:
Even if you clear a question's data, the whole answer history is preserved. All actions performed on a question are listed on the Answer & Visit History sidebar and in the audit trail. In there you can also see which actions result from rule execution. For more information see How does clearing data impact my study?.Syntax
clearValue()
Parameters
None.
Return value
This function itself is used as the return value of a calculation rule. It returns an indicator to the rule process to start data clear in the back end.
Examples
Example 3-109 Depending on a control variable, either clear or return calculated value
logMsg(txtRuleVariable);
if(txtRuleVariable=='clear')
return clearValue();
return txtRuleVariable;
Example 3-110 Given a drop-down (choice) control, either clear the control or set label
if(txtRuleVariable=='clear')
return clearValue();
return setChoiceLabel("Yes");