auto set hidden value if answer option “X” selected in checkbox question


I need to set a hidden value “flag” (X was selected / X was not selected) variable based on a previous multiple response/checkbox question to use for quotas and as a already set variable in the backend data.  I can get the flag to set to 0 (not selected), but having some difficulty getting the script set so if X was selected the hidden value “flag” sets to 1. 

Here is an example of what I have:

%%Q9 = 44;
%%Q10 = 49;
%%X_Flag= 48;


%%output .= sgapiPrint_R (sgapiGetQuestionOptionSelected(%%Q9));
if (sgapiGetQuestionOptionSelected(%%Q9) == “X”) {

Am I approaching this incorrectly?  I’ve scoured the SG help/scripting documentation with no luck… And suggestions or guidance would be appreciated.


Thank you!

Community Admin answered

    Hi Kevin,

    If I had to guess the trouble would be that sgapiGetOptionSelected will return an array of the option skus for each option selected for checkbox questions. I’m no programmer, but you’ll need to evaluate this array for the specific options. I’m thinking sgapiArrayValues might help.

    I hope this helps!

    Bri Hillmer
    Documentation Coordinator
    SurveyGizmo Customer Experience Team

    Community Admin answered


      Question stats

      • Active
      • Views4385 times
      • Answers1 answer
      • Followers1 follower