Auto-populate unchecked boxes with zeroes


I’ve been trying to find an answer to this, but with no luck. My apologies if I missed it.

I want to set up our survey so that empty checkboxes on answered questions return a “0” value, while questions that were skipped remain blank. 

For example:

“Which of these options do you like: A, B, C, or D?”

Respondent 1 answers B and D. I want A and C to register as not selected, say with a zero.

Respondent 2 skips the question. I want all cells to be blank in the export.

Respondent 3 answers B and C. I want A and D to register with zeroes. 

Is there a way to do that on a question by question basis?


IS answered
    IS 2.21K Rep.

    I wrote most of this before seeing Lola’s answer. If the idea of working with custom scripting doesn’t scare you off, and you might want to try it without Gizmo’s programming services, read on.

    You could do it with a custom script using sgapiGetValue and sgapiSetValue, but I don’t think there is a way to do what you want without scripting.

    Even with scripting, I am not sure what side effects you would create if you set a checkbox question value equal to something other than its reporting value or null. You could always create hidden value fields to store the recoded values, but it all gets kind of complex. Depending on your situation, it may be easier to recode outside of SurveyGizmo.

    The code might look something like:

    %%checkboxid = 9;

    %%option1id = 10013;
    %%option2id = 10014;
    %%option3id = 10015;
    %%option4id = 10016;

    %%hiddenvalue1id = 19;
    %%hiddenvalue2id = 20;
    %%hiddenvalue3id = 21;
    %%hiddenvalue4id = 22;

    %%hiddenvalue1value = sgapiGetValue(%%checkboxid, option(%%option1id);
    %%hiddenvalue2value = sgapiGetValue(%%checkboxid, option(%%option2id);
    %%hiddenvalue3value = sgapiGetValue(%%checkboxid, option(%%option3id);
    %%hiddenvalue4value = sgapiGetValue(%%checkboxid, option(%%option4id);

    if (%%hiddenvalue1value == “1” or %%hiddenvalue2value == “1” or %%hiddenvalue3value == “1” or %%hiddenvalue4value == “1”)
    if (%%hiddenvalue1value != “1” { sgapiSetValue(%%hiddenvalue1id,”0″); }
    if (%%hiddenvalue2value != “1” { sgapiSetValue(%%hiddenvalue2id,”0″); }
    if (%%hiddenvalue3value != “1” { sgapiSetValue(%%hiddenvalue3id,”0″); }
    if (%%hiddenvalue4value != “1” { sgapiSetValue(%%hiddenvalue4id,”0″); }

    This requires that you set the reporting value of each checkbox to 1. See:

    I haven’t tested the code above, but it should work okay I think. If you copy and paste code from this forum, be aware that the forum changes the straight quotes that the code requires to left- and right-quotes which will not work. After copy and paste, you would need to fix all of the quote characters.

    To find info about hidden values look here:

    To find question ids and option ids see

    For more info on create a custom script look here:

    Ted McEn commented
      • Looks intriguing to my inner learner.. but might be happening in too many places in the survey so I’ll probably go with cleaning post-export. Thanks for the info!

      Lola Gill 6.99K Rep.

      I’m not aware of such a capability in SG.

      You can apply reporting values (however these have to be unique for each answer option and do not vary depending on whether an option is checked or not):

      What you are looking to do would likely require some sort of customization via scripting. SurveyGizmo has a Pro Services Team that you can consult with on these types of things:

      Hope this helps!

      Ted McEn commented


        Question stats

        • Active
        • Views7644 times
        • Answers2 answers
        • Followers1 follower