Hidden Question from Embedded Data | XM Community
Skip to main content

I’m trying to figure out how to create a hidden question based on the embedded data that I have created. Here is what I have created in the survey flow. I would like to create a hidden question to show in the results tab the number of respondents who fall into the categories that I created in the embedded data based on how they answer the questions in the survey. Respondents fall into these different categories based on how they answer questions in the survey.

 

Right now, the results tab cannot just show how many respondents fall into each segment from the embedded data without a question being answered. The filter tab helps but if someone wants to just see the number of respondents in each segment at the same time without filtering, that option is not possible.

So the idea would be to create a hidden question through the javascript. What is the code that I would use to create this hidden question that would pipe in the segmentation results? For example, could I just create a hidden question that asks “What segment do you fall into?” type in the appropriate Javascript code, and then the segment results would show up in the results tab without the respondent ever seeing the hidden question?

@Sports Trader 

Since, they are landing into a specific category I believe that embedded data is getting filled now based on that embedded data you can use JS to update a choice value with similar segmentations as options in that question.

this.setChoiceValue (choiceId)

But, that question needs to load post the embedded data is filled and also, if you need the visibility hidden you can do it via CSS which will allow the JS to function as well. 

jQuery('#'+this.questionId).css("visibility","hidden");

Hope it helps!


Deepak,

Thanks for your response. So would you recommend that I create a question and then add Javascript code to it through the Javascript function in surveyflow?

Where would I add the css that you are citing?


@Sports Trader Yes, create a hidden question add the JS onload same for CSS as well. 

You need to modify the JS to select answer based off embedded data.


Deepak,

Here is the multiple choice question that I have created for the hidden question:

 

Here is what I see when I try to use the javascript function:

 

 

For the javascript, where would I input this.setChoiceValue (choiceId)  or jQuery('#'+this.questionId).css("visibility","hidden")

 

Thanks


@Sports Trader 

You need to modify JS based on embedded data. 

I am assuming you are filling that embedded data, based on which you will have to modify JS code.

E.g. if Local embedded data is filled, you can modify JS code to 

Qualtrics.SurveyEngine.addOnload(function()
{
    /*Place your JavaScript here to run when the page loads*/
var Local= "${e://Field/Local}"
    if(Local !="") this.setChoiceValue(1,true);
    
});

Similarly for others.

To hide question You can add the JS onload.

Hope it helps!

 


Thanks Deepak. When you say “add the JS onload,” do you just mean keeping the language for  Qualtrics.SurveyEngine.addOnload(function() and deleting the language for Qualtrics.SurveyEngine.addOnReady(function() and Qualtrics.SurveyEngine.addOnUnload(function() in my javascript box?


You can keep the others just include the JS in onload part.


Leave a Reply