Dynamic Answer Choice | XM Community
Skip to main content

I am trying to hide answer choices to a question that have already been chosen ONLY if the respondent chose the same answer to a previous question (Event Date). Below is an example:
1st submission:
Question 1:
image.pngQuestion 2:
image.pngAll 4 options shown, 2 selected.
2nd response:
Question 1: SAME date is chosen
image.pngQuestion 2:
image.pngONLY Seat 3 and 4 are shown because the 1st two seats were already selected

 @chriscraven,

If I understand your request correctly, you want to remove redundant options from the following questions when a question with the same structure is asked in the following block.

All of these, I assume (if asking in a loop, you may need to adjust it slightly), are distinct questions.
.

image.png


Consequently, here is what I have accomplished:
1) I created a logic condition in Q47 here on the page that only appears if Q46 is not empty.

2) I've created Q48 with a display logic condition that appears when Q47 is not empty.

3) Applied display conditions to all options in Q49 as in the image below.


image.png

The first condition checks if the date entered in Q46 matches Q48, and the "OR" condition with  particular option is not  selected in Q47. (if the dates are the same)
And a new logical set "OR" condition to check if the date entered in Q46 does not match Q48. (to display when the date is different).

Hope this resolves your query!!


I think you want to show the seats based on previous respondents response. Like if respondent one selected 2 seats of a particular dates then those seats on same date should not appear to next respondent. Right? I'm not sure it is doable or not. Please check with Quaktrics support.


Thanks for your help qualtrics_nerd. However, I am looking for a dynamic option based on a previous response to the survey, not a previous question ArunDubey pointed out.
I checked with Qualtrics support and they told me it was possible with custom coding, but I am not super familiar with javascript, so I was hoping someone may be able to point me in the right direction.


Custom coding using API?


Hi chriscraven,
I don't this can be possible by using qualtrics only. If I refer your example above you want to assign a seat to a respondent dynamically. You will be needing a simple yet strong database management here. Imagine 2 respondents giving at same time and select same dates. what will happen at the end of survey? You might need to consider acid properties of DBMS as well in this scenario.


ArunDubey I use the API fairly frequently for exporting data but have never used it within a survey. Do you have suggestions on which endpoints to look into for something like this?
dipeshsingh I agree, I would need to build a pipeline that updates in near "real-time," which is what I have actually created using the API. But, I am not sure how to use that data to influence the answer displays of a current question.


As per my understanding, there is no need of API. In any case you will need to use webservices and need to apply json codes for data retrive and save.
you can follow below steps:
1) in the first web service which will implement before the Question: you can apply json code to pull the data from external database (MySQL, ms access etc) you will checked the save data of a colume and pull the data in array format under embedded field.
2) you can use that embedded filed to get the array and disabled amd grey hide already selected checkbox by provious respondents. Only unselected check box will be enabled for new and current respondents.
3) you will create another web services after that question and post the selected data of current user through json and will save it to your external DB for further respondents validation.


ArunDubey Thanks for the detailed answer. I will start looking into web service and incorporating that in the survey.


Great. All the best chriscraven .


Leave a Reply