[Solved] custom result values


Can we handle below cases with custom scripting or javascript action? I checked the forum and found the similar case (https://script.surveygizmo.com/help/article/link/update-hidden-values) but not exactly the same as my case. I would like to populate 3 values after a single choice question is selected. values will be different based on the choice he/she selects. For example, if a respondent selects A, the program will need to generate 3 values (e.g. a=2,b=3,c=4) in one hidden question, if a respondent selects B, the program will generate another 3 values (e.g. a=4,b=3,c=4) in the hidden question and so on….. My approach is to have a custom script or javascript action where I can do some coding like ”  …if a is checked, hidden value a=2, b=3, c=4 else if b is checked, a=4, b=3, c=4 and so on.. In addition, I will need these value to be shown later in the other part of the survey.

Jacob Hayslett selected answer

    Best answer


    Hi Robert,

    This is possible and I use it quite often on my surveys.

    I use SG Custom Script inside of a if loop ( or case, whatever you prefer ) to get this to work.

    For example my custom script would look like:

    %%answer = sgapiGetValue(2)   // insert question id for “2”

    if (%%answer == “1” ) {

    sgapiSetValue(3,”Answer 1″) // replace 3 with the question id you would like to alter and “Answer 1” with it’s new value

    sgapiSetValue(4,”Answer 1″)

    sgapiSetValue(5,”Answer 1″)

    } else if (%%answer == “2” ( {

    sgapiSetValue(3,”Answer 2″)

    sgapiSetValue(4,”Answer 2″)

    sgapiSetValue(5,”Answer 2″)

    } else {

    sgapiSetValue(3,”Answer 3″)

    sgapiSetValue(4,”Answer 3″)

    sgapiSetValue(5,”Answer 3″)



    Resources to assist you – 

    PHP If Loop

    SG Get Value

    SG Set Value


    Jacob Hayslett selected as best answer


      Question stats

      • Active
      • Views340 times
      • Answers1 answer
      • Followers0 followers