I've used the code in this post (How to pipe and rank statements in an earlier question to a new constant sum matrix — Qualtrics Community) to get the top 3 statements.... but I couldn't work out how to modify this to get the top 5 statements. Is it possible or do I need to use a different approach?
Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
const qid = this.questionId;
available_choices = Qualtrics.SurveyEngine.QuestionInfo[qid].Choices;
tot_choices = []
for(keys in available_choices){
tot_choices.push(keys);}
choice_set ={};
i=1;
tot_choices.forEach(item =>{
option_score = document.getElementsByName("QR~"+qid+"~"+item)[0].value;
option_name = document.getElementById("header~"+qid+"~"+i).innerText.trim();
choice_set[option_name] = option_score;
i++;
});
const sorted_choices = Object.fromEntries(
Object.entries(choice_set).sort(([,a],[,b]) => b-a)
);
i = 1;
for(keys in sorted_choices){
Qualtrics.SurveyEngine.setEmbeddedData("top_"+i, keys);
i++;
}
});
JavaScript to get top 5 statements from a Constant Sum Matrix Table
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.
