# References in the Model - Quick Guide

**URL:** <https://community.omni.co/t/references-in-the-model-quick-guide/418>\
**Category:** Modeling\
**Tags:** modeling, ide\
**Created:** [November 10, 2025, 10:52pm UTC](https://community.omni.co/t/references-in-the-model-quick-guide/418 "2025-11-10T22:52:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![James](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@James](https://community.omni.co/u/James)\
**Post date:** [November 10, 2025, 10:52pm UTC](https://community.omni.co/t/references-in-the-model-quick-guide/418/1 "2025-11-10T22:52:42Z")

</div>

Omni’s modeling syntax provides flexible and powerful ways to reference fields, views, and filters in your data models. This guide outlines best practices for using field references and Mustache templating to make your models clear, maintainable, and dynamic.

## Field Reference Best Practices

When referencing fields, best practices is to **use the fully scoped syntax** unless you are inside the same view file. This ensures that field references remain explicit and unambiguous, especially in large models.

### Fully Scoped Syntax

Use the following pattern:

`${view_name.field_name}`  
This syntax ensures Omni correctly resolves both the view and field, regardless of where it’s used.

### Understanding view\_name

In Omni, the view name typically follows the pattern:  
`schema_name__view_name`  
**Note:** There are two underscores between the schema and view names.

You can always confirm the correct reference by checking the comment at the top of a view file:  
`# Reference this view as analytics__orders`  
If a default\_schema is set on the connection, any views in that schema will omit the schema prefix, simplifying references to views in the default schema:

`${orders.total_amount}`  
instead of  
`${default_schema__orders.total_amount}`

### Referencing Inside a View File

When you’re working within the same view file, Omni allows shorthand syntax:

${field\_name} – refers to a field within the same view

${view\_name} – can reference another view directly (depending on context)

### Using Mustache for Dynamic References (Templated Filters)

Omni supports Mustache templating for dynamic or conditional logic within your models. This is especially useful for parameterizing filters, attributes, and SQL fragments. Mustache syntax can also be used to build [dynamic content on the dashboard](https://docs.omni.co/docs/visualization-and-dashboards/dynamic-vis-and-text).

1. Referencing User Attributes  
User attributes can be accessed via the omni\_attributes object:

`{{ omni_attributes.attribute_name }}`  
Use this to dynamically insert attribute values into queries or logic blocks.

2. Referencing Templated Filters  
Templated filters allow models to dynamically adapt to user selections or parameters.

**Basic Filter Value Reference**  
Use filter values as strings (for example, in a FROM or WHERE clause):

`{{ filters.view.field.value }}`

**Date Range Start and End References**  
When dealing with date filters, you can reference the start and end of a templated range:

`{{ filters.view.field.range_start }}`  
`{{ filters.view.field.range_end }}`  
This dynamically computes time differences between the start and end of a chosen date range.

**Default values**  
Default values can be set with templated filters using default value syntax.

`{{^ view.field.filter }} default_value_sql￼{{/ view.field.filter }}`

For more on templated filters, see our [docs](https://docs.omni.co/docs/modeling/templated-filters)
