Relevance & Skip Logic

Follow

The “Advanced Properties” area in the Build Forms tab provides “skip” and “relevance” options which can be used for applying very sophisticated logic to the behavior of your form.

When to Use Relevance Logic vs. Skip Logic

Both relevance and skip logic can be used to control the navigation of a form.  But there are some very noticeable differences in how the work in particular situations.

When to use relevance logic:

  • When you want to control if questions are visible or not depending on the condition.  Questions with relevance logic will be invisible in a form until the relevance condition is met.
  • When you want to control is a question will be required.  Then a question is invisible, doForms does not check its required status.  Only after the relevance condition is met, and the question is displayed, will doForms check the required status.

When to use skip logic:

  • When you wish to jump over large parts of a form using just one condition.
  • When you do not need to hide questions (just skip over them)
  • When there are no required questions that will be skipped over.  Even when skipped over, doForms will evaluate the required status of questions.

In most cases using relevance logic is preferable to skip logic because to the greater control it provided over if a question will be visible and if its required status will be checked.

Adding Skip Logic

You can apply skip logic to jump from one question to any other question below it (or to the end of the form). This is done by evaluating the answer to the original question based on a condition, and then jumping to the destination question if that condition is met. 

In the example below, the skip condition can be interpreted as “skip to the end of the form if the answer to the current question is A”.

You may also use “compound” skip logic to evaluate two or more skip conditions using AND/OR logical operators (see section below). 

Note that you cannot use skip logic to create loops. Use Repeatable Sections for looping.


IMPORTANT: Skip logic is automatically cleared whenever the properties of any of the questions involved are altered. For this reason, we recommend adding skip logic last and always checking it prior to saving a form as Published.

Adding Relevance Logic

You can apply relevance logic to ignore a question based on the answer to any question above it. This is done by evaluating the answer to the prior question based on a condition and ignoring the current question if that condition is not met. 

In the example below, the relevance condition can be interpreted as “if the answer to the media image capture question above was ‘no_media’, then display the current sketch question.” Otherwise, the current sketch question would be ignored.

The example below also illustrates how relevance logic can be used to make robust forms that contain alternative questions when a certain type of hardware input is not available. In this example, if the mobile device does not possess a camera, the previous image capture question would have been skipped over automatically, and the value “no_media” assigned to that image capture question would have been used to trigger the current sketch question as an alternative.

 

Another useful tactic is to use the “not equal” operator with a “blank” answer value. The example below would cause the relevance logic to trigger if any one of the answers to the select multiple question is checked. The alternative for achieving this result would be to use the “equal” operator in multiple compound logic statements (see next section).

 

You may also use “compound” relevance logic to evaluate two or more relevance conditions using AND/OR logical operators (see section below). 

IMPORTANT: Relevance logic is automatically cleared whenever the properties of any of the questions involved are altered. For this reason, we recommend adding relevance logic last and always checking it prior to saving a form as Published.

Compound Logic

Both the Skip Logic and Relevance Logic features provide the ability to use multiple logical conditions. As an example, supposed you have building inspection form with the following Select Multiple question: 

Furthermore, in a situation where both Basement and Crawlspace are selected, you would like Numeric Question to be displayed where you can enter the percent that is basement. 

Then, you might use the compound relevance logic below to specify that the Percent Basement question will only be displayed if Basement and Crawlspace are checked above:

 

Applying compound logic can be a little bit tricky. Logical operators are evaluated from left to right, and in the following order:

1.       Evaluate all “less than” and “greater than”, next
2.       Evaluate all “equals to”, next
3.       Evaluate all logical “AND”, next
4.       Evaluate all logical “OR”, next.

Below are a few examples which illustrate how certain compound conditions will be interpreted in the doForms mobile app:

Compound Condition Example 1:

Under_Structure is equal “Basement” AND Under_Structure is equal “Crawlspace”.

             Result:

If Under_Structure = “Basement” only => Percent_Basement is not displayed
If Under_Structure = “Basement” & “Crawlspace” => Percent_Basement is displayed
If Under_Structure = “Basement” & “Crawlspace” & “Slab” => Percent_Basement is displayed
If Under_Structure = “Basement” & “Crawlspace” & “Slab” & “Hillside” => Percent_Basement is displayed
If Under_Structure = “Basement” & “Slab” => Percent_Basement is not displayed
If Under_Structure = “Basement” & “Hillside” => Percent_Basement is not displayed 

Compound Condition Example 2:

Under_Structure is equal “Basement” AND Under_Structure is equal “Crawlspace” OR Under_Structure is equal “Slab”

             Result:

If Under_Structure = “Basement” only => Percent_Basement is not displayed
If Under_Structure = “Basement” & “Crawlspace” => Percent_Basement is displayed
If Under_Structure = “Slab” => Percent_Basement is displayed
If Under_Structure = “Basement” & “Slab” => Percent_Basement is displayed
If Under_Structure = “Basement” & “Hillside” => Percent_Basement is not displayed
If Under_Structure = “Basement” & “Slab” & “Hillside” => Percent_Basement is displayed.

Compound Condition Example 3:

Under_Structure is equal “Basement” AND Under_Structure is equal “Crawlspace” OR Under_Structure is equal “Slab” OR Under_Structure is equal “Hillside”

             Result:

If Under_Structure = “Basement” only => Percent_Basement is not displayed
If Under_Structure = “Basement” & “Crawlspace” => Percent_Basement is displayed
If Under_Structure = “Basement” & “Slab” => Percent_Basement is displayed
If Under_Structure = “Basement” & “Hillside” => Percent_Basement is displayed
If Under_Structure = “Slab” => Percent_Basement is displayed
If Under_Structure = “Hillside” => Percent_Basement is displayed
If Under_Structure = “Slab” & “Hillside” => Percent_Basement is displayed

Tip: Consider using the “Hide field in mobile app” property in special text, numeric, date:time and calculation questions to store data values that can be used to trigger relevance or skip logic conditions.

Have more questions? Submit a request

Comments

Powered by Zendesk