Conjoint Scripting

Can I branch a Conjoint question to a different questions based on the concept that is selected and not selected?

Yes, this can be done using Java Script. Please refer to the below example:

Survey Software Help Image

In the above example, Vizio was selected, so the flow of the question should be as below:

  • Q1. Conjoint Question
  • Q2. Why did you select Vizio?
  • Q3. Why did you not select Sony?

To set this branching, set up the entire survey, along with all the follow-up questions and add a single select question after Conjoint question type and follow the below steps:

  • Click on Edit icon for the single select question
  • Click on Settings and click on Validation and Display settings
  • Turn on the option for Post JavaScript Validation
  • Enter the below JavaScript code here
  • Click on Save
  • Survey Software Help Image
var q1_1 = $survey.getQuestionByCode('Q1').getTask(0). getSelectedConcept() .getLevelForFeature(0).levelText;
var q1_1n = $survey.getQuestionByCode('Q1').getTask(0). getNotSelectedConcepts() [0].getLevelForFeature(0).levelText;
var q1_2 = $survey.getQuestionByCode('Q1').getTask(1). getSelectedConcept() .getLevelForFeature(0).levelText;
var q1_2n = $survey.getQuestionByCode('Q1').getTask(1). getNotSelectedConcepts() [0].getLevelForFeature(0).levelText;
$survey.updateCustomVariable(1, q1_1);
$survey.updateCustomVariable(2, q1_2);
$survey.updateCustomVariable(3, q1_1n);
$survey.updateCustomVariable(4, q1_2n);

How can I ensure that Q2 shows the option that is selected in Q1? For example, in this case above, Q2 shows Vizio as it was selected in Q1.

To do this, the second part of the Javascript code (refer the code below), is the code for piping the text selected in Q1:

Survey Software Help Image
$survey.updateCustomVariable(1, q1_1);
$survey.updateCustomVariable(2, q1_2);
$survey.updateCustomVariable(3, q1_1n);
$survey.updateCustomVariable(4, q1_2n);
For further assistance in the custom variables, you may contact our representative directly, as the code may vary depending on the requirement.

War dieser Artikel hilfreich?
Das tut uns leid
Wie können wir es verbessern?