I have a matrix table question like this:
Feature1
.
.
Feature6
and the scale is: A - excellent, B - good, C - satisfactory, D - less than satisfactory, Unfamiliar with this feature
I now have a loop and merge block that asks about the features where C or D was selected.
This is the question:
Why did you rate {FEATURE} as {SCALE SELECTED}?
Ex. Why did you rate Feature1 as satisfactory?
What's the most efficient way to do this?
Solved
Piping an alternative text instead of the selected choice text within a loop and merge block
Best answer by ahmedA
- You could look at using setChoiceValueByRecodeValue instead, since you are using recode values.
- Take a look at
getChoices
andgetAnswers
. Sometimes, Qualtrics assigns weird values to these if some changes have been made to the question. So, while you maybe thinking the choices go from 1 to 6...they may actually be going from 13 to 19 internally. - If nothing else works, you can take a look at the following code:
Qualtrics.SurveyEngine.addOnReady(function () {
// Assuming that the following values were chosen in the previous question
// You'll get these from the previous answer
prev_choices = [5, 2, 3, 4, 1, 2];
// To match the JS indexing scheme (map 1-5 to 0-4 )
prev_choices = prev_choices.map((item) => (item -= 1));
// Iterate over each row of the matrix table
all_rows = this.getQuestionContainer().querySelectorAll("tr");
// Index starts from 1, as the first row is the header
for (i = 1; i < all_rows.length; i++) {
p = prev_choices[i - 1];
a = all_rows[i].querySelectorAll("[class^=q-]");
a[p].click();
}
});
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
