How do I separate multiple choice responses into separate categories?
Scenario: A multiple choice checkbox field lists a series of drugs a participant might be taking. Those drugs are organized into categories and we need to quickly determine which categories of drugs the participant is taking.
Solution:
Step 1: Create the Checkboxes (Multiple Answers) field. Nothing special here, just each drug listed with a sequential number value.
Step 2: On a separate form, create a separate Calculated fields associated with each response of the Checkbox field. Each Calculated field will use an if/then statement to say if the drug is selected (equals 1), recode the value to the number given for the drug class to which it belongs, otherwise, return a value of zero.
For example: if([meds_types(1)]=1,4,0) Note: (where 4 is the value given for Anxiolytics and Sedative/hypnotics as seen in figure 3 below)
If desired, add the @HIDDEN action tag to these fields to prevent them from displaying in a form and/or survey.
Step 3: Create a Checkboxes (Multiple Answers) field defining the drug classes (antidepressant, seizure, stimulants, etc). Use the @DEFAULT action tag to pull in the values of each calculated field, thus placing a check beside each drug class associated with a selection on the first field.
For example: @DEFAULT="[meds_1_calc], [meds_2_calc],[meds_3_calc],[meds_4_calc],[meds_5_calc],[meds_6_calc],[meds_7_calc],[meds_8_calc],[meds_9_calc],[meds_10_calc],[meds_11_calc],[meds_12_calc],[meds_13_calc],[meds_14_calc],[meds_15_calc],[meds_16_calc],[meds_17_calc],[meds_18_calc],[meds_19_calc],[meds_20_calc],[meds_21_calc],[meds_22_calc],[meds_23_calc],[meds_24_calc],[meds_25_calc],[meds_26_calc],[meds_27_calc],[meds_28_calc],[meds_29_calc],[meds_30_calc],[meds_31_calc],[meds_32_calc]"