Counting displayed choices in matrix questions | XM Community
Skip to main content

I have a multiple matrix question in a survey and based on multiple different conditions, few of the statements in grids are going to be hidden.
I have to found out exactly how many number of statements are shown to the respondents in matrix questions of a specific section of the survey.

Is there any way we can calculate this?

If you look at the piped text, there’s an option for “Displayed Choices”, this will give you a list (comma seperated) of all the choices that were displayed.

If you don’t have any special characters or comma’s in your choices, this JS should store them in an ED called choices_shown:

Qualtrics.SurveyEngine.addOnReady(function () {
const quest = this;
const numChoices = quest
.getChoices()
.map((a) => quest.getChoiceDisplayed(a))
.filter((a) => a).length;

Qualtrics.SurveyEngine.setEmbeddedData("choices_shown", numChoices);
});

 


@ahmedA, thanks for responding. We have special character like comma present in our choices, so do you have any work around to tackle this. Might be if we can replace comma with any other text before counting the displayed choices.


Leave a Reply