I am using a hotspot question which has a lot of regions about 30. I would like to group these regions and create embedded data to report them. I was wondering if anyone can help me with the javascript.
I want something in lines of
Group1: region1-5
Group2: region 6-10
...
Many thanks in advance
Hi Simin,
Are you just wanting to report the on/off state of each?
If you don't mind doing things (fairly) manually, you could do soemthing like the following:
var group1 = [
"${q://QID1/ChoiceGroup/SelectedAnswers/1}",
"${q://QID1/ChoiceGroup/SelectedAnswers/2}",
"${q://QID1/ChoiceGroup/SelectedAnswers/3}",
"${q://QID1/ChoiceGroup/SelectedAnswers/4}",
"${q://QID1/ChoiceGroup/SelectedAnswers/5}"
];
var group2 = 2
"${q://QID1/ChoiceGroup/SelectedAnswers/6}",
"${q://QID1/ChoiceGroup/SelectedAnswers/7}",
//etc, continue until you have all of your groups completed
];
//if you want to store each group as embedded data
Qualtrics.SurveyEngine.setEmbeddedData('Group1', group1);
Qualtrics.SurveyEngine.setEmbeddedData('Group2', group2);
//etc
Note: QID1 probably won't be the correct ID to use and that your SelectedAnswers might not start at 1 either. Qualtrics assigns these IDs automatically. An easy way to check is to just pipe in the first value in your survey somewhere and note down what it spits out.
If you also want to store the description of each region, you'll need to play around with the code a bit more and probably tweak it for your specific use-case.
Good luck!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.