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

# bind

> Passes filter values from other fields into the subquery defined in a query view.

This parameter will explicitly pass only the enumerated field to the query view. If you want to pass any filters used in the UI into the query view, use [`bind_all_filters`](/modeling/query-views/parameters/bind-all-filters).

## Limitations

**Only supported for query views based on modeled workbook queries**. If defining a SQL-based query view using the `sql` parameter, use a [parameterized `WHERE` clause](/modeling/templated-filters/#parameterized-where-clause-in-views-based-on-a-sql-query) to achieve the same results.

## Syntax

```yaml theme={null}
query:
  filters:
    <filter_field>:
      bind: <other_view_name>.<other_field_name>
```

## Properties

<ParamField path="query" type="object[]">
  An object containing the individual parameters that make up a query view's query definition.

  <Expandable title="query properties" defaultOpen="true">
    <ParamField path="filters" type="object[]">
      An object containing the filter to apply to the query.

      <Expandable title="filters properties" defaultOpen="true">
        <ParamField path="filter_field" type="string">
          The name of the field that the field in `bind` will be bound to, specified as `view_name.field_name`.

          <Expandable title="filter_field properties" defaultOpen="true">
            <ParamField path="bind" type="string">
              The field to bind the filter to, specified as `view_name.field_name`.
            </ParamField>
          </Expandable>
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

## Examples

```yaml title="Bind order_items.created_at to users.created_at" highlight={6-8} theme={null}
query:
  fields:
    users.id: id
    order_items.sale_price_sum: sale_price_sum
  base_view: order_items
  filters:
    users.created_at:
      bind: order_items.created_at
  sorts:
    - field: order_items.sale_price_sum
      desc: true
  topic: order_items
```

***

In this example, `bind` is used to push a filter down onto a view that is being re-aggregated over. This enables putting filters on the reaggregate via the `filter` field while mapping to the underlying query rather than the query view.

```yaml title="Push filter down onto re-aggregated view" theme={null}
query:
  fields:
    order_items.user_id: user_id
    order_items.count: dim_count
  base_view: order_items
  filters:
    users.created_at:
      bind: orders_by_user.created_at
  sorts:
    - field: order_items.count
      desc: true
  topic: order_items
dimensions:
  dim_count: {}
  user_id:
    primary_key: true
measures:
  count:
    aggregate_type: count
filters:
  created_at:
    type: timestamp
```
