[Solved] Random selection of selected grid columns

0

Dear GizmoCommunity,

I have a Radio Button Grid question (4 columns) where the participants indicate which insurances they are currently using. From all those “currently used” insurances I would like to select randomly ONE and save it in a hidden Radio Button question (–> pre-selected / default answer). I need this hidden question for page logics.

I have run out of ideas. Is there a possibility to build this kind of random selection?

Thanks in advance!

Best regards,
Chris

Christian selected answer

    Best answer

    0

    1.) Saving the random selection in a hidden Radio Button question is not needed.
    2.) Only one of the “currently used” insurances (mobility / home / health); prioritize non-mobility over mobility.

    Solution:

    %%tableAnswers = sgapiGetValue(53);
    %%first3rows = array(“Mobility insurance” => %%tableAnswers[56], “Home insurance” => %%tableAnswers[57], “Health insurance” => %%tableAnswers[58]);
    %%yesAnswers = array();

    foreach (%%first3rows as %%insurance => %%answerArray) {
      foreach (%%answerArray as %%key => %%val) {
      if (%%val == “Currently used” && %%insurance != “Mobility insurance”) {
        %%yesAnswers[] = %%insurance;
      }
      }
    }

    if (sgapiCount(%%yesAnswers) === 0) {
      sgapiSetValue(179,”Mobility insurance”);
    }

    else {
      sgapiShuffle(%%yesAnswers);
      sgapiSetValue(179,%%yesAnswers[0]);
    }

    sgapiSubmitSurvey();
    sgapiJumpToPage(144);

    Christian selected as best answer
      0

      This does sound like something that would be possible, but would require a bit of custom scripting implementation (the scope of this is outside of my personal expertise unfortunately).

      Having said that, SurveyGizmo does offer a service for custom projects such as this:

      https://www.surveygizmo.com/programming-services/

      If this is an option for you, it’s worth exploring.

      Cheers!

      Dominic Sharpe answered
        ×

        Login

        Question stats

        • Active
        • Views3131 times
        • Answers2 answers
        • Followers1 follower