---
title: "Switch"
description: "Evaluate branches in order and take the first match, or the default outlet."
canonical_url: "https://docs.vettero.com/build/workflows/blocks/condition/switch"
---
# Switch

> Evaluate branches in order and take the first match, or the default outlet.

<block-meta block="Yes" channels="Any" folder="basic/condition" group="Condition" groupTo="/build/workflows/blocks/condition" icon="i-lucide-git-fork" pipe="Value" scope="Any" tool="No" type="cond.switch">



</block-meta>

**Switch** checks **branches** from top to bottom and continues on the first query that matches. If none match, it continues on the **default** outlet. Use it when a [workflow](https://docs.vettero.com/build/workflows) should pick one of several paths (status, type, channel, and similar).

For a single true/false query, use [Condition](https://docs.vettero.com/build/workflows/blocks/condition/condition).

## Configure

You always have at least one branch.

<table>
<thead>
  <tr>
    <th>
      Setting
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        Branches
      </strong>
    </td>
    
    <td>
      Ordered list. Each row is a case with its own query
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Add branch
      </strong>
    </td>
    
    <td>
      Append a case. A new outlet appears on the block
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Edit
      </strong>
    </td>
    
    <td>
      Open the query builder for that case (AND/OR, rules, nested groups, <strong>
        Not
      </strong>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Remove
      </strong>
    </td>
    
    <td>
      Delete a case (not available when only one branch remains)
    </td>
  </tr>
</tbody>
</table>

Queries work like [Condition](https://docs.vettero.com/build/workflows/blocks/condition/condition): left-side fields come from this block’s context. Empty or unmatched queries do not win; evaluation moves to the next branch, then the default outlet.

Order matters. Put the most specific cases first so a broad rule does not catch everything.

## Handles

<table>
<thead>
  <tr>
    <th>
      Handle
    </th>
    
    <th>
      Role
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        In
      </strong>
      
       (target)
    </td>
    
    <td>
      Incoming connection
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Case
      </strong>
      
       (one per branch)
    </td>
    
    <td>
      Continues when that branch is the first match
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Default
      </strong>
      
       (source)
    </td>
    
    <td>
      Continues when no branch matches
    </td>
  </tr>
</tbody>
</table>

Connect every case you care about, plus default if unmatched values should still continue. An unconnected outlet ends that branch.

## Pipe schema

The next block reads this on the data pipe (`pipe.value`).

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Branch
    </td>
    
    <td>
      text
    </td>
    
    <td>
      Id of the matching case, or the default outlet when nothing matched
    </td>
  </tr>
</tbody>
</table>

## Use case

- Route by status, type, or source: each value is a branch instead of a chain of [Condition](https://docs.vettero.com/build/workflows/blocks/condition/condition) blocks.
- Keep a fallback path on **default** (unknown status, missing field) so the run does not stop.
- Inside a loop, send each item down a case for its category and handle the rest on default.

<block-page-nav>



</block-page-nav>


## Sitemap

See the full [sitemap](https://docs.vettero.com/sitemap.md) for all pages.
