> ## Documentation Index
> Fetch the complete documentation index at: https://helpdocs.gavel.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflows: Show Questions and Pages

> Control which questions and pages your clients see by adding conditional logic to individual questions or entire questionnaire pages in Gavel.

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.

<Steps>
  <Step title="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.
  </Step>

  <Step title="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.
  </Step>

  <Step title="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.
  </Step>

  <Step title="&#x22;X&#x22; Out of the Logic Menu and Save Workflow">
    Click on the "X" on the upper right hand side of the Logic Menu. Then be sure to "Save" your workflow.

    During the interview, Gavel evaluates the logic in real time — the question appears or disappears based on what the client has already answered.
  </Step>
</Steps>

### Example scenarios

<AccordionGroup>
  <Accordion title="Show a spouse-related question only if the client is married">
    Set the condition on the "Spouse's Name" question to **Show if** `MaritalStatus` equals `"Married"`. Clients who select any other marital status skip the question entirely.
  </Accordion>

  <Accordion title="Hide an explanation question after a qualifying answer">
    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.
  </Accordion>

  <Accordion title="Show a question based on multiple conditions">
    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.
  </Accordion>
</AccordionGroup>

***

## 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.

<Steps>
  <Step title="Locate the page">
    In the workflow builder, find the page you want to make conditional.
  </Step>

  <Step title="Open the logic panel">
    Click the **Logic** icon on the page (it looks like a logic tree or branching diagram).
  </Step>

  <Step title="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.
  </Step>

  <Step title="&#x22;X&#x22; Out of the Logic Menu and Save Workflow">
    Click on the "X" on the upper right hand side of the Logic Menu. Then be sure to "Save" your workflow.

    Gavel will route clients past this page entirely when the conditions are not satisfied.
  </Step>
</Steps>

<Note>
  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.
</Note>

***

## Tips for building reliable logic

<Tip>
  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.
</Tip>

<Warning>
  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.
</Warning>

<Info>
  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.
</Info>
