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.
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"));
});
});
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.
