Hello,
I have a PGR question that gives respondents 12 items, asks them to add as many as they want to a group, and then rank those (there's only one group). I need to set just the three highest ranked items as embedded data to be asked about later. It would be easier to work with the values instead of the labels, but either is fine.
This question (https://community.qualtrics.com/XMcommunity/discussion/14303/rank-order-carry-forward-using-embedded-data) showed how to set the top three items from a Rank Order question as embedded data.
This question (https://community.qualtrics.com/XMcommunity/discussion/16799/saving-pick-group-rank-responses-to-embedded-data-with-javascript) showed how to set PGR group responses as embedded data, but in my testing it doesn't always select the three highest ranked items.
I'm trying to do a combination of these tasks. I'm very new to Javascript and am having a hard time figuring it out.
Thank you in advance for any help.
Solved
How to set a certain number of responses from pick group rank as embedded data
Best answer by TomG
This will give you the choice ids of the three highest ranked items:
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
jQuery("#"+this.questionId+" .Group li").each(function(i) {
if(i<3) Qualtrics.SurveyEngine.setEmbeddedData("rank"+(i+1),jQuery(this).attr("data-choiceid"));
});
});
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
