Count selections in a side-by-side by row? | XM Community
Skip to main content
Hi Qualtrics community,



I have a side-by-side question with a multiple-answer column. Like this:



Q1

Which seasons did you do the following activities?

ROWS:

Rode a bike

Drove a car

Flew a plane



COLUMNS

Spring

Summer

Winter

Fall



The next question displayed should only show up if they selected more than one season for any given row. How do I display/show/hide/compute the number of selected choices across a row vs a column? Qualtrics is letting me do "Display if selected answer SPRING count is..." kind of logic, but not "Display if Robe a Bike selected answer count is..."



Any ideas?



I was trying to use JavaScript to count the selections on a row, but I'm also having trouble getting that to work...
After you have set up your side by side, click the gear to the left and select Scoring. Set up a category for each row, then enter the score you want if it is selected.



Set the scores to an embedded data variable and you can then use the embedded data for enabling future questions.
How do you set an embedded data variable equal to a score OnPageSubmit?



I cannot use Survey Flow to set embedded data because I have to allow the respondent to back up to previous questions.
Another question regarding scoring:



If I enable scoring in the survey I notice that that Scoring ID generated as a text fill is very different from other elements. If I export the survey and then pass that qsf file over to another Qualtrics account, would the scoring ID still be the same?
If you want your users to back up, you will have to implement your scoring algorithm in javascript.



You have to create an addOnPageSubmit block in the javascript editor. Put the scoring algorithm there. Make sure that you use absolute scoring (instead of additive scoring) so that the score is not increased if the user goes back.



After you have calculated the score save it to embedded data:

Qualtrics.SurveyEngine.setEmbeddedData('EmbeddedDataName', value);



For question #2: have not tried that yet, sorry.
> @Pete_L said:

> Another question regarding scoring:

>

> If I enable scoring in the survey I notice that that Scoring ID generated as a text fill is very different from other elements. If I export the survey and then pass that qsf file over to another Qualtrics account, would the scoring ID still be the same?



Exporting the QSF and importing in same or different account doesn't change the scoring ID.
> @Pete_L said:

> How do you set an embedded data variable equal to a score OnPageSubmit?

You can't. You have to wait until the next page to assign the embedded data variable.
I've figured out the text fill part (I think) but not the display issue. For the dynamic text ('season' vs. 'seasons') I can OnLoad reference the row's score value and use jQuery to change the text displayed based on that.



I'm still having trouble hiding a question entirely based on the previous question's selections across a row vs. down a column though. Need to keep working on some kind of funky solution for it!
@Pete_L,



Did you consider using a multi-answer, transposed matrix instead where the answers are Rode a bike, Drove a car, etc in the rows and the choices are the seasons in the columns? That way you can access the counts you need and not use any JS.
I did consider that but Qualtrics has stated that the default matrix grids are not 508 Compliant / WCAG AA accessible.



And of course that is a requirement for the project I'm working on, so I am limited to individual questions or the side-by-side grid format. One of my suggestions to the team has been to take these out of a grid, because you can do display logic based on counts from a single multiple choice question.
Here's an idea - does anyone know if you can use getSelectedChoices to function on a row of a side-by-side?



I could compare the .length of that return value and if it's greater than >1, assume more than one option has been selected and set the embedded data appropriately.

Leave a Reply