DenchClaw Filters: Advanced Filtering Guide
A complete guide to DenchClaw's filtering system — operators, field types, combining filters, and saving views for instant access.
DenchClaw Filters: Advanced Filtering Guide
DenchClaw's filter system is the engine that powers saved views, natural language queries, and AI-generated perspectives on your CRM data. Understanding how filters work — the operators available, how to combine them, and how they translate to SQL — helps you build powerful views and get more from the natural language interface.
How Filters Work Under the Hood#
Every filter in DenchClaw eventually becomes a SQL WHERE clause applied to a PIVOT view. When you create a saved view with filters, DenchClaw:
- Reads the filter configuration from
.object.yaml - Translates each filter condition to a SQL predicate
- Executes the combined query against the appropriate
v_OBJECTNAMEPIVOT view - Returns the matching rows to the frontend
The filter YAML and the SQL are in 1:1 correspondence. Understanding the YAML means understanding the SQL.
Filter Structure#
A filter block in .object.yaml looks like this:
filters:
- field: Status
operator: equals
value: ActiveMultiple filters default to AND logic:
filters:
- field: Status
operator: equals
value: Active
- field: City
operator: equals
value: "San Francisco"Translates to:
WHERE "Status" = 'Active'
AND "City" = 'San Francisco'All Filter Operators#
Text Operators#
| Operator | SQL Equivalent | Example |
|---|---|---|
equals | = 'value' | Status equals "Active" |
not_equals | != 'value' | Status not equals "Churned" |
contains | ILIKE '%value%' | Name contains "Smith" |
not_contains | NOT ILIKE '%value%' | Notes not contains "competitor" |
starts_with | ILIKE 'value%' | Email starts with "info@" |
ends_with | ILIKE '%value' | Email ends with "@gmail.com" |
is_empty | IS NULL OR = '' | Phone is empty |
is_not_empty | IS NOT NULL AND != '' | Email is not empty |
Number Operators#
| Operator | SQL Equivalent |
|---|---|
equals | = value |
not_equals | != value |
greater_than | > value |
less_than | < value |
greater_than_or_equal | >= value |
less_than_or_equal | <= value |
between | BETWEEN value1 AND value2 |
is_empty | IS NULL |
Date Operators#
| Operator | SQL Equivalent |
|---|---|
equals | = 'YYYY-MM-DD' |
before | < 'YYYY-MM-DD' |
after | > 'YYYY-MM-DD' |
between | BETWEEN date1 AND date2 |
today | = CURRENT_DATE |
yesterday | = CURRENT_DATE - 1 |
this_week | BETWEEN date_trunc('week', CURRENT_DATE) AND ... |
last_week | Previous 7-day window |
next_week | Next 7-day window |
this_month | date_trunc('month', ...) |
last_month | Previous month |
this_quarter | date_trunc('quarter', ...) |
this_year | date_trunc('year', ...) |
in_the_past | CURRENT_DATE - INTERVAL 'N days' |
in_the_future | > CURRENT_DATE |
is_empty | IS NULL |
Tags Operators#
| Operator | Behavior |
|---|---|
contains | Tag array includes this value |
contains_all | Tag array includes all values in list |
contains_any | Tag array includes at least one value |
not_contains | Tag array does not include this value |
is_empty | Tag array is empty or null |
Boolean Operators#
| Operator | Behavior |
|---|---|
is_true | Value = true |
is_false | Value = false or null |
AND / OR Logic#
Simple AND (default)#
All conditions must match — this is the default when you list multiple filter conditions:
filters:
- field: Status
operator: equals
value: Active
- field: Score
operator: greater_than
value: 80Explicit AND / OR#
For explicit logic control:
filters:
operator: AND
conditions:
- field: Status
operator: equals
value: Lead
- field: City
operator: equals
value: "New York"OR logic:
filters:
operator: OR
conditions:
- field: Priority
operator: equals
value: Critical
- field: Close Date
operator: before
value: "2026-04-01"Nested Logic#
Combine AND and OR for complex filtering:
filters:
operator: AND
conditions:
- field: Status
operator: not_equals
value: Churned
- operator: OR
conditions:
- field: Priority
operator: equals
value: High
- field: Score
operator: greater_than
value: 90This finds entries where Status is not Churned AND (Priority is High OR Score > 90).
Dynamic Filters (Relative Dates)#
One of the most powerful filter features: relative date operators always resolve to current date. A view with Close Date is this_month will show different deals in October vs. November — the filter is live, not static.
This means your saved view "Closing This Month" is genuinely useful every month without manual updates.
Filters in Natural Language#
You don't have to write YAML to set filters. Ask DenchClaw:
"Show me all active deals with a close date this quarter and deal value over $10,000."
DenchClaw generates the filter configuration, applies it, and returns results. If you then say "save this view as 'High Value Q1'," DenchClaw writes the filter to your .object.yaml.
The natural language filter capability means you can explore your data with plain English and only formalize filters into saved views when you find ones worth keeping.
Combining Filters with Sort and Columns#
Filters are more powerful when combined with sort order and visible column selection:
views:
- name: Stale Deals
filters:
- field: Status
operator: not_equals
value: Closed Won
- field: Status
operator: not_equals
value: Closed Lost
- field: Last Activity
operator: in_the_past
value: 14 days
sort:
field: Last Activity
direction: asc # Stalest first
columns:
- Deal Name
- Company
- Stage
- Last Activity
- OwnerSee also: DenchClaw Saved Views for saving and managing filter configurations, and Natural Language Queries for filter-as-conversation.
Frequently Asked Questions#
Can I filter by a field that's not shown in the current view columns?#
Yes. Filters operate on the data independently of which columns are visible. You can filter by "Last Contacted" even if that column isn't shown in the table view.
How do I filter for NULL values?#
Use the is_empty operator. For date fields, this finds entries where the date field was never set. For text fields, it finds entries where the field is NULL or an empty string.
Can filters reference values from other objects (cross-object filters)?#
Cross-object filters (e.g., "show deals where the linked company has more than 100 employees") require a subquery. You can ask DenchClaw in natural language and it will construct the appropriate join query, though saving these as YAML views requires custom SQL which DenchClaw can also generate.
Is there a limit to how many filters I can combine?#
No practical limit. Complex nested filters translate to complex SQL, but DuckDB handles them efficiently. For extremely complex filter trees, consider whether a saved view or a custom report query might be cleaner.
How do I filter by tags (multi-select field)?#
Use the contains operator for single-tag matching: Tags contains "Enterprise". Use contains_all to require multiple tags: Tags contains_all ["Enterprise", "Q4 Target"]. Use contains_any for OR matching across tags.
Ready to try DenchClaw? Install in one command: npx denchclaw. Full setup guide →
