Pipe options to Continuous Sum – how to skip but still assign a value?


I’m thinking there is a way to do this using a custom script… 

In a multiple choice question I ask something like “which flavors of ice cream do you like to eat?” 

Then I pipe the options they select into a continuous sum question and ask ‘what % of the time do you choose each flavor” 

If they only select that they like to eat vanilla I want to skip them past the continuous sum question, but I want the survey to capture a data point —  100% — for the question being skipped.

I’m trying to avoid having respondents complete unnecessary questions and get annoyed. 

Any insight from the might survey brains? 

amy_aha answered

    You could use the sgapiCheckboxTotalChecked function in an IF statement to evaluate how many answer options had been chosen on the checkbox question.  If the number was ‘1’, the script would execute the sgapiJumpToPage or the sgapiHideQuestion to skip over the continuous sum question.  Make sure that you use the PageID number if you use the JumpToPage function.

    The assignment of an answer to the skipped continuous sum question is a little more difficult.  The sgapiSetValue function can be used to enter a response for a skipped question.  However, the documentation does not mention how to set the values for a continuous sum question.  The documentation does describe how to set values for arrays so it might be possible, but I have no personal experience with this type of situation to guide you.

    If we were going to do this, we would place the checkbox question and the continuous sum questions on different pages and separate them with an ADMIN ONLY page containing the script. The following is a rough pseudo-code version of the script:

    If sgapiCheckboxTotalChecked(x)=1
    {%%options = sgGetValue(x);

    You might want to consider setting up a separate survey with just the checkbox and continuous sum questions as a testing site for the script. Then when you have a working version you can copy it over to the actual survey.

    Jim Wetherill answered

      Jim, thanks for the quick response. I will play around with these suggestions. If I get it working I will share the results!  

      amy_aha answered


        Question stats

        • Active
        • Views2038 times
        • Answers2 answers
        • Followers1 follower