/
How do I reference checkbox fields in logic?

How do I reference checkbox fields in logic?

Think of a Checkbox or “select all that apply” field as a series of fields where each response may be selected. Each of the responses can have a value of “0” (not selected) or “1” (selected). With that in mind, you need to reference the field choice along with the variable name when writing branching logic or calculations that include checkboxes – [variable(value)] = '0' or [variable(value)] = '1'.

Example:

In the example below, the question “What is your favorite shade of blue?" is hidden unless Blue is selected as a response to “What is your favorite color?”

image-20240711-062417.png
image-20240711-062951.png

Note that checkboxes are never blank, they are not selected. If logic is based on a choice not being checked, [variable(value)] = ‘0' is the appropiate logic as opposed to [variable(value)] = ''. The later option will not cause errors in your REDCap project, but it can cause unexpected results in other features such as the Data Quality Module.

Related content

How do I use quotation marks in REDCap conditional logic?
How do I use quotation marks in REDCap conditional logic?
More like this
Can I add branching logic to REDCap section headers?
Can I add branching logic to REDCap section headers?
More like this
How do I enable surveys in my REDCap project?
How do I enable surveys in my REDCap project?
More like this
Using Logic in REDCap
Using Logic in REDCap
Read with this
How do I create a report in REDCap?
How do I create a report in REDCap?
More like this
New Sample Form Checklists
New Sample Form Checklists
More like this