Hi there! I'm new to the community and happy to be here. I write with what I hope is a reasonable request, let me describe my problem.
The survey that I'm building has, early on, a drill-down question that tries to get at a respondent's geographic location. It's not in the U.S., but to give a point of reference you can imagine it like selecting State -> County. (In my case, ~30 "states", and ~1,000 "counties").
Now, these ~1,000 counties can be divided into 4 groups (that the respondent knows nothing about) and I'd like to create survey branches based on these groups. To make things a little more intuitive, imagine a simple example where you have counties 1-10 and groups A or B (picture attached below) I'd like to do something like, if you answered 1, 2, 3, 5, or 7 for "county", then create embedded data as "A". If you answered 4, 6, 8, 9, 10 for "county", then create embedded data as "B".
This will allow me to branch the survey for the "A" group and "B" group separately, without respondents knowing which group they're in. This is a much better and more efficient alternative than making ~1,000 branches for each county.
I have a .csv with how counties link to groups, and would be fine pasting it into Javascript code or something. Something like a solution to this problem https://community.qualtrics.com/XMcommunity/discussion/9855/import-csv-file-to-use-in-embedded-data-possible that actually works for logic would also work.
Do you think this is possible? Any help would be greatly appreciated!
P.S. In case it's useful, more generally, I'm trying to implement a block randomized experimental design (note that block != what Qualtrics calls blocks) where you separate out respondents into groups and then randomize within each group, as opposed to randomizing everyone together. This greatly improves the precision of resulting estimates! It's trivial to do so in Qualtrics with the branch tool (e.g., if you want to block by gender, just make branches of the survey for each gender), but this becomes unwieldy very quickly, and I can't imagine the solution for me is to manually make hundreds of branches.
Hi all, I was able to resolve this issue by setting an embedded data field at the beginning of the survey that was blank, and then writing Javascript code to update it once the respondent has answered the key question, and then branching the survey according to the embedded data.
Something like:
var county = "${q://QID4/ChoiceGroup/SelectedAnswers/2}";
if (county == "1") {
Qualtrics.SurveyEngine.setEmbeddedData("t_condition", "A");
}
if (county == "4") {
Qualtrics.SurveyEngine.setEmbeddedData("t_condition", "B");
}
and so on. I created the code by printing it in R to a .txt file, so it was all automated.
JulianGerez - I just noticed your question. Looks like you already solved it a different way, but I have a state/region JS function that automatically groups states into regions (or counties into states as in your example).
https://community.qualtrics.com/XMcommunity/discussion/comment/45892#Comment_45892Thanks! In my case this wouldn't have been useful because I'm not working in the U.S., but I hope others find it helpful.
https://community.qualtrics.com/XMcommunity/discussion/comment/46692#Comment_46692The function is not country dependent. It can be used to do any type of grouping.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.