Hello,
I have a Pick, Group, Rank question I am trying to sort, but I am wanting to reference only one group and sort that specific list for the top 4 choices. How can I create an array based off of a list? Thank you so much for your help.
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
jQuery('#QID1').find('ul')[0].id;
jQuery('#QID1').find('ul')[1].id;
var choice = [
["${q://QID1/ChoiceNumericEntryValue/Rank/1}","${q://QID1/ChoiceDescription/1}"],
["${q://QID1/ChoiceNumericEntryValue/Rank/2}","${q://QID1/ChoiceDescription/2}"],
["${q://QID1/ChoiceNumericEntryValue/Rank/3}","${q://QID1/ChoiceDescription/3}"],
["${q://QID1/ChoiceNumericEntryValue/Rank/4}","${q://QID1/ChoiceDescription/4}"],
];
console.log(choice)
choice.sort();
Qualtrics.SurveyEngine.setEmbeddedData('first',choice[0][1]);
Qualtrics.SurveyEngine.setEmbeddedData('second',choice[1][1]);
Qualtrics.SurveyEngine.setEmbeddedData('third',choice[2][1]);
Qualtrics.SurveyEngine.setEmbeddedData('fourth',choice[3][1]);
});
Page 1 / 1
It can't be done with piping and sorting because there isn't a way to pipe statements by group.
The captureRanks function does it. If you are going to do it yourself, you would need to use a similar approach.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.