Use this command to display a Checkbox on the interview.
Command structure:
«ChooseUsingCheckBox(Beneficiary,Y,N,N)»
Examples of usage:
The command can be written as simply as this, and when the data element is chosen its value will be ‘true’ and when not chosen, an empty string. For example:
«ChooseUsingCheckbox(Beneficiary)»
«When(Beneficiary = “true”,yes,no)»
The command is quite customizable, so another variation could be:
«ChooseUsingCheckBox(Beneficiary,Y,N,N)»
«When(Beneficiary = “Y”,is a beneficiary,is not a beneficiary)»
In this case the values are as follows:
Y is the value when the checkbox is checked
The first N is the value when the checkbox is unchecked
And the second N is the default value of the checkbox.
Where this default value is not specified (as in «ChooseUsingCheckBox(AttendSchool,Yes,No)»
) or is specified but is neither the value when checked nor the value when unchecked (e.g.«ChooseUsingCheckBox(AttendSchool,Yes,No,Don't Know)»
)) then the checkbox is first shown in the indeterminate state – i.e. neither checked nor unchecked.
Checkbox captions
By default, captions are on the left hand side of checkboxes. It might be more desirable to place the captions on the right hand side with this trick:
«Child_FirstName» «Child_LastName»
«ChooseUsingCheckbox(IsBeneficiary,Y~~The child is a beneficiary,N,N)»
«Caption(IsBeneficiary,)»
Instead of your checkbox looking like this:
It would look like this:
Change the caption dynamically:
It is possible to include data elements in captions, so as to bring some context to the interview. Read more about that concept here:
Here is an example using the script technique, which will include the values captured by the user, in the caption of checkbox.
«Child_FirstName» «Child_LastName»
«Script(ChildName)»«concat(SuffixWith(Child_FirstName,' '),Child_LastName)»«ScriptEnd()»
«ChooseUsingCheckbox(IsBeneficiary,Y~~<ChildName()||Name> is a beneficiary,N,N)»
«Caption(IsBeneficiary,)»