I am using a matrix drag and drop on Qualtrics to ask respondents to sort 46 statements into the categories: agree less, neutral, and agree more (QID1).
QID1
In QID6 I ask them to sort the statements carried forward from the category agree less into -5 to 0.
QID6
Then in QID7 I ask them to sort the statements carried forward from the category agree more into 0 to 5.
QID7
In QID4 I show them how they sorted the statements (from -5 to 5) from QID6 and QID7. However, I wanted to combine how they sorted the responses in QID1, QID6, and QID7 specifically for the neutral and 0 responses. However, I have been unsuccessful at getting all the statements to carry forward. If only one statement was put into each of the categories of neutral (in QID1), category 0 in QID6, and category 0 in QID7 then those three statements appear in QID4.(QID1selection, QID6selection, QID7selection, result)
However, if more than one statement is placed into any of those categories (neutral in QID1 or 0 in QID6 and 7), then none of them appear in QID4. This does not seem to be an issue for the statements selected in the other categories (-5,-4,-3,-2,-1,1,2,3,4,5). Is this an issue with length or is concat the incorrect function to use? I am not familiar with javascript at all, so I am having a hard time figuring out what is the issue.
Below is the Javascript function I am using (based on this discussion post: https://community.qualtrics.com/XMcommunity/discussion/14728/carry-forward-response-into-drag-drop-box)
Qualtrics.SurveyEngine.addOnReady(function () {
let ques = this;
//let a1 = "${q://QID1/ChoiceGroup/SelectedChoicesForAnswer/1}";
let a2 = "${q://QID1/ChoiceGroup/SelectedChoicesForAnswer/2}"; //this is neutral
//let a3 = "${q://QID1/ChoiceGroup/SelectedChoicesForAnswer/3}";
let b1 = "${q://QID6/ChoiceGroup/SelectedChoicesForAnswer/1}";
let b2 = "${q://QID6/ChoiceGroup/SelectedChoicesForAnswer/2}";
let b3 = "${q://QID6/ChoiceGroup/SelectedChoicesForAnswer/3}";
let b4 = "${q://QID6/ChoiceGroup/SelectedChoicesForAnswer/4}";
let b5 = "${q://QID6/ChoiceGroup/SelectedChoicesForAnswer/5}";
let b6 = "${q://QID6/ChoiceGroup/SelectedChoicesForAnswer/6}"; //this is 0
let c1 = "${q://QID7/ChoiceGroup/SelectedChoicesForAnswer/1}"; //this is 0
let c2 = "${q://QID7/ChoiceGroup/SelectedChoicesForAnswer/2}";
let c3 = "${q://QID7/ChoiceGroup/SelectedChoicesForAnswer/3}";
let c4 = "${q://QID7/ChoiceGroup/SelectedChoicesForAnswer/4}";
let c5 = "${q://QID7/ChoiceGroup/SelectedChoicesForAnswer/5}";
let c6 = "${q://QID7/ChoiceGroup/SelectedChoicesForAnswer/6}";
let d1 = a2.concat(b6,c1); //this should combine all the statements selected for QID1 (ans2), QID6 (ans6), and QID7 (ans1)
let choice_text = ques.getChoiceContainer().innerText.split(/\\n/gm);
let all_choices = ques.getChoices();
let all_answers = ques.getAnswers();
for (let i = 0; i < choice_text.length; i++) {
let set_choice= -1
switch (true) {
case b1.includes(choice_text[i]):
set_choice = all_answers[0];
break;
case b2.includes(choice_text[i]):
set_choice = all_answers[1];
break;
case b3.includes(choice_text[i]):
set_choice = all_answers[2];
break;
case b4.includes(choice_text[i]):
set_choice = all_answers[3];
break;
case b5.includes(choice_text[i]):
set_choice = all_answers[4];
break;
case d1.includes(choice_text[i]): //this should show all the statements selected for QID1 (ans2), QID6 (ans6), and QID7 (ans1)
set_choice = all_answers[5];
break;
case c2.includes(choice_text[i]):
set_choice = all_answers[6];
break;
case c3.includes(choice_text[i]):
set_choice = all_answers[7];
break;
case c4.includes(choice_text[i]):
set_choice = all_answers[8];
break;
case c5.includes(choice_text[i]):
set_choice = all_answers[9];
break;
case c6.includes(choice_text[i]):
set_choice = all_answers[10];
break;
}
ques.setChoiceValue(all_choices[i], set_choice, true);
}
});
I would appreciate it if anyone can point me to the right direction or to any helpful resources.
Length issue with Javascript carry-forward choices?
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
