Skip to main content
Question logic lets you build an adaptive interview experience where clients only see questions that are relevant to their situation. Rather than presenting every possible question to every client, you define conditions — based on earlier answers — that determine whether a question or a whole page should appear. This keeps your questionnaire focused, reduces completion time, and prevents clients from being confused by questions that don’t apply to them. Gavel supports logic at two levels: question-level logic (show or hide a single question) and page-level logic (show or hide an entire page of questions). Both work the same way and can include multiple AND/OR conditions.

Question-level logic

Question logic controls the visibility of an individual question based on how the client answered a prior question.
1

Open the question editor

In your workflow builder, navigate to the question you want to make conditional. Click the Edit Logic button on that question.
2

Add a condition

In the logic panel, choose whether the question should be shown or hidden when the condition is met. Then select the variable (from a prior question) and the answer value you want to trigger that behavior.
3

Add multi-condition logic (optional)

Click Add Conditions to add another rule. You can chain multiple conditions using AND (all conditions must be true) or OR (any condition must be true) to handle more complex scenarios.
4

Save

Save the question. During the interview, Gavel evaluates the logic in real time — the question appears or disappears based on what the client has already answered.

Example scenarios

Set the condition on a follow-up explanation field to Hide if HasPriorConviction equals False. Only clients who answered “Yes” to the prior conviction question will see the explanation prompt.
Use AND logic: show the “Trust Beneficiary Name” question only if DocumentType equals "Trust" AND ClientHasBeneficiaries is True. Both conditions must be satisfied for the question to appear.

Page-level logic

Page logic works the same way as question logic, but controls the visibility of an entire questionnaire page. If the conditions are not met, the client skips the page completely — none of the questions on that page are asked, and their variables remain blank.
1

Locate the page

In the workflow builder, find the page you want to make conditional.
2

Open the logic panel

Click the Logic icon on the page (it looks like a logic tree or branching diagram).
3

Add conditions

Choose Show if or Hide if, then select the variable and answer value. Add additional conditions with Add Conditions using AND or OR as needed.
4

Save

Save the page settings. Gavel will route clients past this page entirely when the conditions are not satisfied.
Page-level logic is especially useful when you have several questions that all depend on the same prior answer. Rather than adding logic to each question individually, you can group them on a single page and apply one condition to the whole page.

Using prior answers inside questions

In addition to show/hide logic, you can reference a prior answer directly inside the text of a later question. This is useful for personalizing question wording or confirming what the client previously entered. Use the ${VariableName} syntax anywhere in a question’s label, helper text, or answer choices:
Hello ${ClientFirstName}. What is your current mailing address?
You can also use a prior answer as one of the selectable choices in a multiple-choice question. For example, if an earlier question collected a spouse’s name in SpouseName, you can offer it as a choice later:
Who should be named as the primary beneficiary?

A. ${SpouseName}
B. A trust
C. Other
If the client entered “Richard” for SpouseName, Choice A will display as “Richard” in the questionnaire.

Showing conditional text inside a question

You can display different text within a question’s instruction block based on a prior answer. Use this pattern in an Instruction block:
${ "You are married" if MaritalStatus == "Married" else "You are not married" }
For more complex conditional content — such as showing entire paragraphs — use Instruction blocks together with Calculations (Invisible Logic). You can also show inline messages that depend on calculations:
${ "You do not qualify. Please stop." if ((Income + Assets) < 10) else "You qualify. Please proceed." }
Date-based conditions work the same way:
${ "We are sorry. You are too late." if date_difference(starting=FilingDate).days > 30 else "Great. Let's continue." }

Tips for building reliable logic

Always place the question that supplies the condition before the question that depends on it in the questionnaire. Logic can only reference answers from prior questions — not later ones.
If a question is hidden by logic, its variable will be blank in the generated document. Make sure any conditional content in your document template accounts for blank values using {% if VariableName %} guards.
You can combine question logic and page logic in the same workflow. A common pattern is to use page logic to route clients into a specialized section, then use question logic within that section to fine-tune which fields appear.