Can I ask a conditional question based on the answer to another?

Learn how to ask follow-up questions based on the answers to another question.

Using the JustProtect Template, you can set a specific question to only show if the answer conditions are met for another linked question.

In your template, include the supported column "Condition" which will be the column in which we enter the conditional statement.

The syntax of the condition, when based on the answer to another question, is:

question["id"] = "answer"

Because the condition is dependant on the ID of another question, "External ID" is required, and External ID must be unique for each question.

Example

In this example, we have an Assessment with two questions.

Question 1 has an external ID of "A1.1" and is multiple choice with the answer choices "Red", "Blue", and "Green."

Question 2 has an external ID of "A1.1.1", and the question begins "If Red, ..."

Question 2 would use the following expression to only display if Question 1 is answered Red:

question["A1.1"] = "Red"

Chaining

You can chain these expressions together for complex cases using AND or OR.

In the above example, Question 2 might ask "If Red or Blue, ..." In this case, the expression you would use is:

question["A1.1"] = "Red" OR question["A1.1"] = "Blue" 

Mixing Questions

The conditional statement can also mix various questions in a single condition by utilizing multiple External IDs.

For example, in a 4 question True or False example, (using external IDs Q1 through Q4,) Question 4 could appear only if questions 1-3 are answered True.

To do so, you could use:

question["Q1"] = "True" AND question["Q2"] = "True" AND question["Q3"]

If you wanted Question 4 to only show if ANY of 1-3 is True, you could use:

question["Q1"] = "True" OR question["Q2"] = "True" OR question["Q3"]

Rules to consider

The Conditional statements are case sensitive and work best with pre-defined answers such as Multiple Choice Single Answer and Multiple Choice Multiple Answer questions.

Make sure that the answer condition matches the answer choice perfectly.

Want to try it?

We've placed a few conditional statements in our default template. We'd be more than happy to walk you through your next Assessment conversion.