Hello everyone,
I've recently had the need to set a counter in a Ad Hoc Employee Research Survey to count how many times the same answer was selected.
The survey has questions that can be answered yes, N/A or no and I have the necessity to count how many times yes is selected.
I've tried using embedded data and branch if in the survey flow:
setting the counter "total of yes" and then adding a branch for every question in wich if yes was selected the counter went up.
I was wondering if there were a simplier way to accomplish this.
Thank you in advance
Hi gaiadm_,
You could add some code to each question with the "Yes" option with something like this
if("${q://QID1/ChoiceGroup/SelectedChoices}" == "Yes") {
var counter = "${e://Field/Counter}";
Qualtrics.SurveyEngine.setEmbeddedData("Counter", count + 1);
}
Of course replace "QID1" with the relevant ID for that question :)
Good luck!
Thank you bgooldfed ! This definitely helps. I was wondering if there was a chance to do the same thing without having to set a condition for every question.
You've been very helpful.
Have a good one
Not that I am aware. If you have all of your questions on a single page, I suppose you could use jQuery to find the IDs of all the multiple choice questions and iterate through each one with a single condition. However if they are on separate pages that won't be possible (because the HTML elements are destroyed as the user moves between pages).
If you just want to save yourself from working on multiple code blocks, you could probably just put all of the conditions in your final question block. But you will still need to have a condition for each question you want to check.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.