How to pipe selected answers from 4 separate multiple choice questions (max 2 for each one)

caoanqi Seattle, WA, USACommunity Member Qubie ✭
edited July 21 in Custom Code

Hi all! I currently have 4 multiple choice questions, each requiring up to 2 answer selections with "none of the above" being an exclusive answer selection, and I want the answer selections for all 4 questions (ranging from 0 ~ 8 in total in this case) to be piped into a final question that asks participants to select their final top 3 from.

I am struggling with the JS code for this case. Currently it only works when exactly 2 answers are selected for each of the 4 MC questions, and would pipe in blank spaces for when 1 answer is selected or when "None of the above" is selected for any one of those questions.

Here's what I did:

  1. I added the following pieces of JS code to each respective multiple choice question, and checked "variable naming" under "Recode values" for all questions :

I then created a total of 8 embedded data variables in the survey flow (L1 L2 for question 1, A1 A2 for question 2, H1 H2 for question 3, P1 P2 for question 4)

I know this isn't going to account for the scenario where participants choose only 1 answer for any of the questions, but I don't know how to revise the code and embedded data to incorporate it. Please advise. Thank you!


  • ShenR
    ShenR Community Member, Qualtrics Brand Admin Qubie ✭

    Hello, if your list of options is short, you don't have to use JavaScript. Just set your "final question" to have the masterlist of options from the 4 questions then use the display logic to only show the options[in your final question] selected from the 4 questions.