Dear All,
I'm looking for some input on a survey I've been programming. Respondents will complete the survey every 3 months over the course of 2 years and I'm striving to minimize survey burden for questions that ask about use of current medications. The survey is setup as follows:
* Respondents complete a baseline survey via an anonymous link, and after entering an e-mail address, the folks at Qualtrics helped me setup API calls that create a new contact list entry and I'm also using an API call to send out survey invitations and survey reminders via the Qualtrics mailer.
* I was initially advised to save respondent's answers for the medication questions to embedded data fields that are subsequently added to the respondent's contact list entry via API/web services in the survey flow portion of the survey. In turn, I piped the embedded data values for the medication questions on a summary screen that is presented for all subsequent follow-up surveys. This approach works in theory, but it gets pretty messy and I'm hoping there's a simpler approach than using the API.
* While the baseline survey is accessed via an anonymous link, the follow-up survey invitations use individual survey links.
* Ideally, I'd love to have the previous answers to the medication questions be the default answer choices for the next follow-up survey. For example, the default choices for the medication questions on the follow-up survey (Time 1) would be the choices made during the baseline survey (Time 0), the choices selected at Time 1 would be the default choices for the medication questions at Time 2, etc.
* Would the following JavaScript be what I'm looking for?
Qualtrics.SurveyEngine.addOnload(function() {
this.setChoiceValueByRecodeValue("${q://QID6/SelectedChoicesRecode}", true);
});
Thanks in advance.
Page 1 / 1
No, ${q://QID6/SelectedChoicesRecode} refers to the selected choice in the current survey, not the previous survey. The default choices will have to come from the contact list as embedded variables. So, for example if you saved the Time 0 Q6 recode in your panel as T0Q6recode, then it would be:
```
Qualtrics.SurveyEngine.addOnload(function() {
this.setChoiceValueByRecodeValue("${e://Field/T0Q6recode}", true);
});
```
```
Qualtrics.SurveyEngine.addOnload(function() {
this.setChoiceValueByRecodeValue("${e://Field/T0Q6recode}", true);
});
```
Thanks, Tom! Your response is incredibly helpful. I've added the JavaScript to the questions that are presented during the follow-up surveys using the embedded data from the contact list. For example, at Time 0, I have an embedded data field labeled Rx1, which holds the first medication the respondent selected. At Time 1, however, the embedded contact list variables aren't being displayed as the default choices. Any places where I might troubleshoot?
Is this.setChoiceValueByRecodeValue("${e://Field/T0Q6recode}", true); case sensitive?
Is this.setChoiceValueByRecodeValue("${e://Field/T0Q6recode}", true); case sensitive?
> @NJS_JHMI said:
> Thanks, Tom! Your response is incredibly helpful. I've added the JavaScript to the questions that are presented during the follow-up surveys using the embedded data from the contact list. For example, at Time 0, I have an embedded data field labeled Rx1, which holds the first medication the respondent selected. At Time 1, however, the embedded contact list variables aren't being displayed as the default choices. Any places where I might troubleshoot?
>
> Is this.setChoiceValueByRecodeValue("${e://Field/T0Q6recode}", true); case sensitive?
Yes, the function name and embedded data name are both case sensitive.
Check your contact list to make sure the embedded data fields are there and you've got them spelled correctly.
> Thanks, Tom! Your response is incredibly helpful. I've added the JavaScript to the questions that are presented during the follow-up surveys using the embedded data from the contact list. For example, at Time 0, I have an embedded data field labeled Rx1, which holds the first medication the respondent selected. At Time 1, however, the embedded contact list variables aren't being displayed as the default choices. Any places where I might troubleshoot?
>
> Is this.setChoiceValueByRecodeValue("${e://Field/T0Q6recode}", true); case sensitive?
Yes, the function name and embedded data name are both case sensitive.
Check your contact list to make sure the embedded data fields are there and you've got them spelled correctly.
Checked the contact list and the embedded data fields (and stored values after I completed the baseline) are there, and I double-checked that the function name was spelled correctly and didn't contain extra spaces.
Could the issue be related to how I'm piping the survey responses for the embedded data fields that are being saved to the contact list? For example, I'm piping a survey response for any given question using the 'selected choices.' For this to work, do I need to be piping the responses using 'selected choices recode' instead? Tried to add a screencap of my survey flow, but I'm the Imgur link I added doesn't appear to be working.
Here's a link instead: https://imgur.com/a/50ARCPb
Could the issue be related to how I'm piping the survey responses for the embedded data fields that are being saved to the contact list? For example, I'm piping a survey response for any given question using the 'selected choices.' For this to work, do I need to be piping the responses using 'selected choices recode' instead? Tried to add a screencap of my survey flow, but I'm the Imgur link I added doesn't appear to be working.
Here's a link instead: https://imgur.com/a/50ARCPb
> @NJS_JHMI said:
> Checked the contact list and the embedded data fields (and stored values after I completed the baseline) are there, and I double-checked that the function name was spelled correctly and didn't contain extra spaces.
>
> Could the issue be related to how I'm piping the survey responses for the embedded data fields that are being saved to the contact list? For example, I'm piping a survey response for any given question using the 'selected choices.' For this to work, do I need to be piping the responses using 'selected choices recode' instead? Tried to add a screencap of my survey flow, but I'm the Imgur link I added doesn't appear to be working.
>
> Here's a link instead: https://imgur.com/a/50ARCPb
You need to be piping the 'selected choices recode' into your contact trigger to save the recode to the contact list if you are then going to use the setChoiceValueByRecodeValue function to select the choice in the next survey. The value has to be a valid choice recode value. 'selected choices' are the choice text labels.
> Checked the contact list and the embedded data fields (and stored values after I completed the baseline) are there, and I double-checked that the function name was spelled correctly and didn't contain extra spaces.
>
> Could the issue be related to how I'm piping the survey responses for the embedded data fields that are being saved to the contact list? For example, I'm piping a survey response for any given question using the 'selected choices.' For this to work, do I need to be piping the responses using 'selected choices recode' instead? Tried to add a screencap of my survey flow, but I'm the Imgur link I added doesn't appear to be working.
>
> Here's a link instead: https://imgur.com/a/50ARCPb
You need to be piping the 'selected choices recode' into your contact trigger to save the recode to the contact list if you are then going to use the setChoiceValueByRecodeValue function to select the choice in the next survey. The value has to be a valid choice recode value. 'selected choices' are the choice text labels.
That makes sense. I piped in the 'selected choices recode' and it now works perfectly! For questions that are text entry, would I just pipe the embedded data field instead of using this JavaScript function? You've saved me a ton of work, so thanks again for helping me troubleshoot, Tom!
You're welcome.
Yes, for text entry questions just pipe in the embedded data field. No need for JS.
Yes, for text entry questions just pipe in the embedded data field. No need for JS.
NS716 @NJS_JHMI TomG
did you get this sorted in the end? i.e working for multiple choice question repopulation? can you please share the final solution
I have tried the solution posted above to no success, I have posted some new issues identified on this post: https://community.qualtrics.com/XMcommunity/discussion/22392/how-do-you-get-the-embedded-data-from-coded-questions-to-populate-a-follow-up-survey#latest
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.