Conditional Logic: Nesting Conditions and Examples

Download PDF
Cody Davis
Cody Davis
  • Updated

This article is considered appropriate for Next administrators with an intermediate level of knowledge about conditional logic. If you are a beginner, we recommend reading the following articles first:

Contents

Overview

This article provides two examples of creating complex conditional logic in forms, often referred to as nesting conditions.  

Conditional Logic Nesting Conditions

There are times when conditional logic for a form field is more complex than a straightforward if/then statement.  In these instances, nesting conditional logic terms may be required.  

Nesting conditions mean that multiple conditional groups need to be considered before a form field will be shown to candidates.  

The nesting conditions shown in the examples below give a general and high-level explanation of these types of conditions, but may and can differ depending on the needs of the form. 

In the examples below, the following conditions are required to show specific form fields to candidates that meet specific criteria.  These conditions are:

  1. If candidates live in either California or Hawaii, and their major is accounting, a listing of accounting specialties will show for them to complete.
  2. If candidates live in either California or Hawaii, and their major is nursing, a listing of nursing specialties will show for them to complete.
  3. If candidates live in any other U.S. state outside of California or Hawaii, and their major is accounting, a listing of accounting schools will show for them to complete.
  4. If candidates live in any other U.S. state outside of California or Hawaii, and their major is nursing, a listing of nursing schools will show for them to complete.

As mentioned above, these examples may not match every scenario of what is needed in other programs, but it does provide general guidance on these types of relationships between form fields.  Keep in mind that there may also be multiple ways to produce the outcome of showing the form field based on how the conditional logic is assigned, these are just two examples.

Example #1: Two Condition Groups

Here’s how to configure the first set of conditions of showing a listing of accounting specialties if a candidate lives in either California or Hawaii and has an accounting major:

  1. Build a form with all form fields that will be shown depending on their condition.  For example, the fields needed to replicate this example include:
    • A single-select field with a list of U.S. states.
    • A single-select field with a list of majors, including accounting and nursing.
    • A multi-select field with a list of accounting specialties.
    • A multi-select field with a list of nursing specialties.
  2. Select the first field that should be hidden from the applicant until or unless they select Accounting as their major and live in either California or Hawaii; in this example, the first field to add conditional logic to is a multi-select form field of a list of accounting specialties.

  1. Select the Add Display Logic icon.

  1. In the window that appears, the Field dropdown selection defines the trigger condition.  In this example, select In what U.S. state do you reside?, because it is the first of multiple conditions that need to be met for this list of accounting specialties to show.

  1. The Condition dropdown lets Next know that the trigger condition is contingent upon the response either being equal or not equal to the Response selection.  In this example, select Is, because the rule is based on the applicant selecting California as their residential state.

  1. The Response dropdown designates that part of the rule, as related to the previous dropdown selections.  In this example, select California.

  1. Since this example is based on multiple conditions, select the + icon to add another line of conditions to define.

  1. In the Field dropdown of the new line, select Select your major.

  1. In the Condition dropdown, select Is.

  1. In the Response dropdown, select Accounting.

  1. The checkboxes next to each conditional line allow the creation of group conditions by letting Next know which lines to include in the group.  Since both of the two above conditions need to be met to show the multi-select field of accounting specialties to candidates from California, select the checkbox to the left of each of the conditions.

  1. Select the Create Logical Group button.

  1. The rule of And or Or is applied when a logical group is created.  This means that for every condition line included in the group, either all of them need to be true to show the form field (And) or just one of them needs to be true to show the form field (Or).  In this example, select And since both conditions need to be true for the multi-select field of accounting specialties to show.

  1. Since the multi-select field of accounting specialties should show for candidates living in California as well as Hawaii, select the +Add button to insert another condition line.



 

Repeat the above process for candidates who live in Hawaii.  

  1. In the Field dropdown, select In what U.S. state do you reside? 

  1. In the Condition dropdown, select Is.

  1. In the Response dropdown, select Hawaii.

  1. Since these conditions should match what was set up for California, select the + icon to add another set of conditions to define.

  1. In the Field dropdown of the new line, select Select your major.

  1. In the Condition dropdown, select Is.

  1. In the Response dropdown, select Accounting.

  1. Since both of the two above conditions need to be met to show the multi-select field of accounting specialties to candidates from Hawaii, select the checkbox to the left of the two conditions that were just defined.

  1. Select the Create Logical Group button.

  1. Remember when a logical group is created, the rule of And or Or is applied.  In this example, select And since both conditions need to be true in this group for the multi-select field of accounting specialties to show.



 

Notice that at this point, Next does not allow the Done button in the lower right corner of the window to be selected; this is because the logic rule is still incomplete.  The two groups of conditions have been successfully set up, and now Next needs to know how to handle those groups.


  1. Select the checkboxes to the left of the two grouped conditions.

  1. Select the Create Logical Group button.

  1. As with all logical groups, the rule of And or Or is applied.  In this example, select Or since either of the two nested group conditions can be true for the multi-select field of accounting specialties to show.

  1. Select the Done button.

  1. Select the Save button for the multi-select field to save the conditional logic.



 

Repeat the above steps to set up the logic on the multi-select field for nursing specialties if candidates live in either California or Hawaii, and their major is nursing.

 

 

--- IMPORTANT ---

Each form field that needs conditional logic must be set up individually with the appropriate conditional logic.  This means if there is a set of form fields that need to remain hidden until or unless the same conditions are met, each of those form fields needs to have the conditional logic set up separately.  




 

--- REMEMBER ---

Duplicating form fields can copy the conditional logic, but it is limited to the same type of form field.  For example, the conditional logic created for a long answer text box cannot be copied to a single-select field, but can be copied to another long answer text box by duplicating the form field.  An example of this is discussed below in Example #2.




 

Example #2: A Condition Group and a Single Condition

For the third and fourth set of conditions listed at the beginning of this article, the setup is similar to the steps listed above.  As a reminder, the third and fourth sets of conditions are:

  • If candidates live in any other U.S. state outside of California or Hawaii, and their major is accounting, a list of accounting schools will show for them to complete.
  • If candidates live in any other U.S. state outside of California or Hawaii, and their major is nursing, a list of nursing schools will show for them to complete.

Here’s how to apply the third set of conditions of showing a list of accounting schools if a candidate lives outside of California or Hawaii and has an accounting major:

  1. Build a form with all form fields that will be shown depending on their condition.  For example, the fields needed to replicate this example can build on Example #1 above, but must at least include:
    • A single-select field with a list of U.S. states.
    • A single-select field with a list of majors, including accounting and nursing.
    • A single-select field with a list of accounting schools in the United States outside of California and Hawaii.
    • A single-select field with a list of nursing schools in the United States outside of California and Hawaii.
  2. Select the first field that should be hidden from the applicant until or unless they select Accounting as their major and live outside of California or Hawaii; in this example, the first field to add conditional logic to is a single-select form field that lists accounting schools outside of California and Hawaii.

  1. Select the Add Display Logic icon.

  1. In the window that appears, remember that the Field dropdown selection defines the trigger condition.  In this example, select In what U.S. state do you reside?, because it is the first of multiple conditions that need to be met for this single-select field on accounting schools to show.

  1. In the Condition dropdown, select Is Not.

  1. In the Response dropdown, select California since the form field should appear when a candidate selects a state other than California.

  1. Select the + icon to add another set of conditions to define.

  1. In the Field dropdown of the new condition line, select In what U.S. state do you reside?.

  1. In the Condition dropdown, select Is Not.

  1. In the Response dropdown, select Hawaii since the form field should appear when a candidate selects a state other than Hawaii.



 

The two above conditions should now be grouped since either of them being true should reveal the single-select form field of accounting schools outside of California and Hawaii.

  1. Select the checkbox to the left of each of the conditions.

  1. Select the Create Logical Group button.

  1. Recall that the rule of And or Or is applied when a logical group is created.  In this example, select Or since either condition needs to be true for the single-select field of accounting schools to show.



 

Now that the conditions for the residential state have been set up, the condition for the major needs to be added.

  1. Select the +Add button to insert another condition line.

  1. In the Field dropdown of the new condition line, select Select your major.

  1. In the Condition dropdown, select Is.

  1. In the Response dropdown, select Accounting since the form field should appear when a candidate selects accounting as their major.



 

Here is where nesting conditions can get more complex.  For the single-select field to show when candidates live in any other U.S. state outside of California or Hawaii, and their major is accounting, Next needs that to be defined.  Notice that the Done button in the lower right corner of the window cannot be selected; this is because the logic rule is still incomplete.

  1. Select the checkbox to the left of the first group and the new condition line about the candidate’s major.

  1. Select the Create Logical Group button.

  1. Once again, the rule of And or Or is applied when a logical group is created.  In this example, select And since both conditions needs to be true for the single-select field of accounting schools to show.  In this case the conditions are:
  • The candidate’s residential state is not California or Hawaii (the first conditional group created above), and
  • The candidate’s major is accounting (the additional condition line outside the first group).

  1. Select the Done button.

  1. Select the Save button for the single-select field to save the conditional logic.



 

Create another form field with a listing of nursing schools outside of California and Hawaii and repeat the steps above to assign the conditional logic, but use Nursing as the major instead of Accounting.

As an alternative to building this conditional logic again for the list of nursing schools outside of California and Hawaii, duplicate the single-select form field listing accounting schools outside of California and Hawaii, rename it, update the school listing options, then make the small changes to the conditional logic, selecting Nursing as the major.  (If needed, please see the articles titled Copy a Form Field and Configure Form Fields for more information on those topics.)

 

 

--- USER TIP ---

Before setting up a form and the conditional logic, map out exactly what form fields are needed, what conditional logic should be applied to them, and determine the best logic to assign.  

 

Was this article helpful?

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.