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

# If

> Conditionally render the contents based on whether rows are returned by the query.

```liquid theme={null}
{% if data="demo.daily_orders" %}
	Content
{% /if %}
```

## Examples

### Basic Usage

```liquid theme={null}
{% if data="demo.daily_orders" %}
	Content
{% /if %}
```

### With an else branch

```liquid theme={null}
{% if data="demo.daily_orders" condition="has_rows" %}
	There are orders.
{% /if %}
{% else %}
	No orders found.
{% /else %}
```

## Attributes

**data** `string` *required*

Table or view to query

**filters** `array`

IDs of filters to apply to the query

**condition** `string` (default: has\_rows)

Set to "no\_rows" to render children only if the query returns no rows. Set to "has\_rows" (or omit) to render if query returns rows.

**Allowed values:**

* `no_rows`
* `has_rows`

**where** `string`

Custom SQL WHERE condition to apply to the query. For date filters, use date\_range instead.

**having** `string`

Custom SQL HAVING condition to apply to the query after GROUP BY

**limit** `number`

Maximum number of rows to return from the query. Note: When used with tables, limit will disable subtotals to prevent incomplete subtotal rows.

**order** `string`

Column name(s) with optional direction (e.g. "column\_name", "column\_name desc")

**qualify** `string`

Custom SQL QUALIFY condition to filter windowed results


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.