Add Complex Logic to a Question

Complex logic is defined as an IF condition that includes Boolean Operators (AND/OR) where you can define and connect multiple conditions. When creating complex logic, you need to choose dependent questions to base your logic off of, Boolean Operators to connect the conditions, Comparison Operators and Required Field Responses to satisfy your condition.

NOTE: Knowledge of IF condition formats is required.  See the List of Different Survent Types of Conditions solutions article for different IF condition formats.

Boolean Operators

There are 2 Boolean Operators that can connect your conditions together. These Operators are located on the right side of the Logic Editor in a drop down menu for you to choose from:

Boolean Operator Description
AND Choosing the AND Operator means that both parts of the condition in the dependent questions need to be satisfied in order for the question to be executed.
OR Choosing the OR Operator means that only one part of the condition in the dependent questions need to be satisfied in order for the question to be executed.

Grouping

Once you start adding multiple conditions, you can Group conditions together changing the nesting in the parenthesis. There are 2 sets of Groupings. These Groupings are located on the right side of the Logic Editor in a drop down menu for you to choose from:

Grouping Description
Group With Previous Choosing this grouping means that the part of the IF condition you are defining will be grouped together with a previous grouping that has already been defined.
Start New Group Choosing this grouping means that the part of the IF condition you are defining will NOT be grouped with a previous
group. A NEW group will be started and can be satisfied on it’s own.

An example of a complex logic condition that is grouped is IF ( (q1=01) AND (web=02) ) OR (web_use=01) where both And and Or is used along with parenthesis to group the first condition together.

  1. Access the Logic Editor either through the Design View or Logic tab located in the menu bar at the top of the screen
  2. On the left side of the screen, choose the question you want to add logic to
  3. On the right side of the screen, choose the first dependent question to base the condition on
  4. Choose a Comparison Operator from the drop down menu
  5. Choose or enter the required response(s) to satisfy your condition
  6. Click the “Enter Logic Details” button to add your logic
  7. The IF condition will be added to the left and right sides of the screen
  8. To add another condition, click the “Add New Condition” button on the left or right side of the screen
  9. Choose the grouping for your multiple conditions
    1. If you choose Group With Previous, that part of the IF condition you are defining will be grouped together with a previous grouping that has already been defined
    2. If you choose Start New Group, that part of the IF condition you are defining will NOT be grouped with a previous group. A NEW group will be started and can be satisfied on it’s own
  10. Choose the second dependent question to add to your logic
  11. Choose a Boolean Operator to connect the conditions together
    1. If you choose the AND Boolean Operator, both parts of the condition in the dependent questions need to be satisfied in order for the question to be executed
    2. If you choose the OR Boolean Operator, only one part of the condition in the dependent questions need to be satisfied in order for the question to be executed
  12. Repeat steps #4 and #5
  13. Click the “Update Logic Details” button to save your condition

 

In this example, we are adding complex logic to the question labeled PRODUCTS_1.

complex1

A complex IF condition is created using and OR to group the two conditions together.  IF conditions can be as complex as needed.

complex2