Can I set a hidden Question from embedded data? | XM Community
Solved

Can I set a hidden Question from embedded data?

  • 12 March 2019
  • 5 replies
  • 212 views

Userlevel 4
Badge +16
  • QPN Level 3 ●●●
  • 162 replies
I have the following task before me: I have several products in the sample. For these products I should ask the same questions. The obvious thing would be to create a loop&merge block. But it seems I can't use embedded data as fields for the Loop&Merge setup. Hence the idea would be to set a hidden multiple choice questions with the products from the embedded data and base the loop on this question. Would this work and if so how does it work. Thanks a lot for your ideas and support.
Best regards
Rudi
icon

Best answer by PeeyushBansal 12 March 2019, 10:24

View original

5 replies

Userlevel 7
Badge +33
Yes you can create hidden question and punch this based on your embedded variable using java script for example:-

`Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/

var ageres="${q://QID2/ChoiceTextEntryValue}";

if (ageres>="18" && ageres<="24") {this.setChoiceValue(1,true) ; }
if (ageres>="25" && ageres<="34") {this.setChoiceValue(2,true) ; }
if (ageres>="35" && ageres<="44") {this.setChoiceValue(3,true) ; }
if (ageres>="45" && ageres<="54") {this.setChoiceValue(4,true) ; }
if (ageres>="55" && ageres<="65") {this.setChoiceValue(5,true) ; }
var questionDiv = this.getQuestionContainer();
questionDiv.style.display = "none";
});`
Userlevel 4
Badge +16
Thanks a lot for the help. However this works only if the question is displayed. As soon as I hide the question in a display logic it doesnt work anymore.
Userlevel 4
Badge +5
If you just want to hide a block that has your product list that has display logic, this should work
Qualtrics.SurveyEngine.addOnload(function()
{
this.questionContainer.hide();
$('NextButton').click();
});

This basically auto hits the next button so there is just a brief blip.
Also, putting this is the "custom code" category might be useful if you need a quick reply.
Userlevel 4
Badge +16
Thanks a lot for providing the missing bits . It's working fine now.
Userlevel 4
Badge +20

Rudi - I know it's been a while but any chance you can explain or share a QSF file? I have a survey where I want to leverage hidden embedded data for an email workflow.
Ex: Q1 asks them to select their name. If they select Captain America, embedded data (their username/login) equals cptamr. Then I can set the email workflow to come from the user. We have custom from domains set up so I can then use the login as embedded data with our email domain.
I do know who the user is. However, this is the second survey in a Longitudinal survey and I do not want to ask their email and username/login in the first survey. I'm not using the longitudinal survey traditionally. I'm having the 1st survey completed by one person, that triggers a workflow to send the 2nd survey to the email to the address they entered in the survey. The 2nd survey is completed by a different person.

Sorry, that was a lot! Just wanted to paint the picture 🙃

Leave a Reply