**Objective**

After reading this article, you will understand how to show and hide questions in the most efficient way possible.

**Before you get started**

This article might be helpful before you read further:

It's possible to build a template that is so complex that a browser may have trouble rendering it. Follow these guidelines to optimize the performance of your templates as much as possible.

**Limit the logic for dependent conditionally displayed questions to no more than 100 consecutive questions in one template when there are no additional conditionally displayed questions that use “AND” or “OR” logic.****Reason**: Cascading logic is handled using Javascript on the client-side. This means that the processing is performed on the user’s device. Each time a user clicks in any field, the system is evaluating the conditional display logic from the bottom of the form to the top. All of this processing makes it extremely difficult to quickly process the form.**Suggestions**: Instead of using one question to drive individual questions with drive conditional visibility of later questions, group questions together based on similar upstream parents. The inefficient method looks like the following, where the arrow indicates a parent/child relationship, ultimately resulting in grandparent or great-grandparent relationships. Question 1 → Question 2 → Question 3 → Question 4 → Question 5. The more efficient implementation might look like Question 1 → [Question 2, 3, 4, 5]. In this instance, when Question 1 is answered a certain way, four additional questions would appear at once.**Limit the number of times “OR” statements are used in conditional display logic to no more than ### total times.****Reason**: OR logic is more complex than AND logic from a processing standpoint. This is because the system frequently must evaluate all possible options before ruling out field display, especially when the form is set to default to a minimum display. With AND logic, the system can rule out question display if the first result in the complex filter logic doesn’t meet the criteria.**When multiple picklist values can be used to determine conditional display of questions, attempt to combine them into one display condition.**Inefficient Implementation:More efficient implementation:**Avoid double-stating logic.**If logic is defined at the section level, each question within does not need to have the same logic defined.

If “A” only displays if “B” and “B” only displays if “C” you don’t need to list for A “if B OR C”. It should only be “if B”**Avoid excessive combinations of parent-child-grandchild conditional display logic in conjunction with conditional display logic that utilizes “AND” or “OR” statements.**Up to 100 consecutive parent-child relationships can be added to a form template. However, when used along with additional questions that use compound AND/OR statements in the Filter Logic, device performance can degrade quickly. Examples of AND logic are cases where Question 5 only displays when Question 1 = “Yes” AND Question 2 = “Yes” AND Question 3 = “No” and Question 4 = “Yes”. The addition of 3 questions using “AND” logic to a template with 100 consecutive parent-child relationships can slow response time to 2 seconds or more per click. Adding a 4th question that uses “AND” logic reduces the click response time to 10 seconds. A 5th question using “AND” logic reduces click response time to 1 minute. Effectively, the cumulative effect of additional new questions becomes exponentially more of a burden on the user’s device.

Alternative approach for AND logic in cases where too much conditional logic is slowing form performance--Though there are a few steps to this process, the computational overhead for the formula logic is significantly reduced from the original logic that includes several AND statements. The same logic can be used for compound OR statements. The primary difference is that the conditional display logic would simply look for a value greater than 0, as opposed to a value greater or equal to 5.

- Create a Youreka custom formula for each question(s) to convert the question to a mathematical value that can be used in an If/Then formula. In the example below, ROW1 is a number question that takes an integer value from a user and ROW2 is a picklist question where each option has been assigned a weighted value.
- Create a second Youreka custom formula to apply If/Then logic to the custom formula in the previous bullet. The If/Then formula can determine if the weighted values of the previous question meet the criteria to be considered true. If the question meets the criteria, apply a value of 1. If it does not, apply a value of 0. In the image below, if the Conditional Display question is greater than 10, the Formula sets the value to 1, otherwise, it is set to 0.
- Create a final Youreka custom formula to evaluate all of the component drivers. In the image below, each of the 5 conditional display drivers should have a value of 1 to indicate that they fit the criteria specified. If the sum of the rows in the Formula is 5, then the combination of questions meets the criteria. If the sum of the rows is less than 5, the combination does not meet the criteria.
- In the question (or section as seen below) that will be conditionally displayed, set the Display Logic to Conditional Visibility and determine the value that should drive whether it is visible. In our example, we want all 5 factors to be true (for a value of 5) in order for our section to be displayed.

- Create a Youreka custom formula for each question(s) to convert the question to a mathematical value that can be used in an If/Then formula. In the example below, ROW1 is a number question that takes an integer value from a user and ROW2 is a picklist question where each option has been assigned a weighted value.

## Comments

0 comments

Article is closed for comments.