Clear values on a form using custom rules
With the new clearValue()
helper function you can clear
data in a target question for a calculation rule, whether it is a text, number, or choice
question.
With the introduction of the
clearValue()
helper
function, rule developers can now clear a form question using a custom calculation
rule. This function can only be called as part of the return statement of a
calculation rule, which means you can only use this helper function with question
types that can be used as the target for a calculated value, such as:
- Text
- Number
- Choice-type controls (drop-down, checkboxes, or radio buttons)
The
clearValue()
helper function allows you to perform a
"true clear", which is different from simply removing an item's data and replacing it
with an empty string. Data clear is a more complex process that occurs in the backend,
and by using this function you are actually returning an indicator to the rule process
to start a data clear. When data is cleared, the given item state is as if it has never
been answered. With all items in an unanswered state, a form can return to a status of
New. This is important for site users so they can skip visits whenever
necessary or
avoid
having false incomplete visits on a subject's record.
Note:
Even if you clear a question's data, the whole answer history is preserved. All actions 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.You can find additional information in the Rules Developer Guide once the Release Assessment Environment (RAE) upgrade completes.
Parent topic: Rules management