Display question when the same answer is selected over different questions. | XM Community
Skip to main content

Dear all, 

 

I’m currently setting up a discrete choice experiment study, where the respondent will be given 8 different choice sets, over 8 different questions. I want to display a question if the respondent has selected the same option in at least 5 of the 8 questions. 

 

With display logic, I currently displayed the follow-up question if the same option is selected in each of the 8 questions. 

I was wondering if it is possible to work with an If-Then logic, so that the follow-up question is displayed if a certain option is selected in at least 5 out of the 8 questions? 

This is my first time posting, so I am happy to provide more information or be referred to other resources.

 

Thank you for your help! 

@SamV I think in your case it would be better to implement some JavaScript for all of the 8 questions which counts up an embedded data field value on each page submit if the relevant choice is selected. You could then define your condition based on that embedded data.

Are all questions multiple choice with single select? 

Which layout do you use?


@SamV I actually think there is a better way which requires no technical understanding of JavaScript. You can just define some branches (one for each question) which checks if the relevant option was selected and count up some embedded data by 1 using math operations.  

It is important that you define your counter embedded data field as Number and add the spaces correctly for the math operations, e.g., 

$e{ ${e://Field/choiceCounter} + 1 }

The Number type can be selected when you click the “Options” of the embedded data block.

You would need to place the follow-up question in a separate question block after all the branches. The display logic would then be based on embedded data: 

Best
Christian


@SamV I actually think there is a better way which requires no technical understanding of JavaScript. You can just define some branches (one for each question) which checks if the relevant option was selected and count up some embedded data by 1 using math operations.  

It is important that you define your counter embedded data field as Number and add the spaces correctly for the math operations, e.g., 

$e{ ${e://Field/choiceCounter} + 1 }

The Number type can be selected when you click the “Options” of the embedded data block.

You would need to place the follow-up question in a separate question block after all the branches. The display logic would then be based on embedded data: 

Best
Christian

Dear Christian, 

 

I’ve used the embedded data as you’ve described above. Thank you very much for your help! It works perfectly. 

 

Kind regards, 

Sam


@SamV Glad I could help! 😊


Leave a Reply