Conjoint Scripting

Branching a Conjoint question to a different questions based on the concept that is selected and not selected:

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:

  • Goto the single select question.
  • Click on Logic and click on JavaScript Logic.
  • Turn on the option for Post JavaScript Validation.
  • Enter the below JavaScript code here.
  • Click on Save JavaScript Logic.
  • 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.

License & Access Options

This feature/tools described here are available with the following license(s) :

Team Edition

Unlimited Surveys, Questions, Responses

Advanced Toolset and Features

No Long Term Commitment