210 lines
3.2 KiB
Markdown
210 lines
3.2 KiB
Markdown
---
|
|
title: Dataview Query Examples
|
|
category: Reference
|
|
date: 2026-02-23
|
|
tags: [dataview, queries, obsidian, examples]
|
|
---
|
|
|
|
# Dataview Query Examples
|
|
|
|
**Plugin:** [Obsidian Dataview](https://github.com/blacksmithgu/obsidian-dataview)
|
|
**Your Vault Location:** `C:\Users\admin\Documents\Corey`
|
|
|
|
---
|
|
|
|
## 📊 Summary Statistics
|
|
|
|
### All Files in Vault
|
|
```dataview
|
|
TABLE file.mtime AS "Modified", file.size AS "Size"
|
|
FROM ""
|
|
SORT file.mtime DESC
|
|
LIMIT 20
|
|
```
|
|
|
|
### Files by Category
|
|
```dataview
|
|
TABLE rows.file.name
|
|
FROM ""
|
|
WHERE category
|
|
GROUP BY category
|
|
```
|
|
|
|
---
|
|
|
|
## 🏠 Home Assistant Queries
|
|
|
|
### Show Home Assistant Notes
|
|
```dataview
|
|
TABLE status, total_automations AS "Total", active_count AS "Active", unavailable_count AS "Broken"
|
|
FROM "Home Assistant"
|
|
SORT file.name
|
|
```
|
|
|
|
### Recent HA Updates
|
|
```dataview
|
|
LIST
|
|
FROM "Home Assistant"
|
|
WHERE date_generated
|
|
SORT date_generated DESC
|
|
```
|
|
|
|
---
|
|
|
|
## 📁 Projects Dashboard
|
|
|
|
### Active Projects Only
|
|
```dataview
|
|
LIST
|
|
FROM "Projects"
|
|
WHERE contains(file.content, "Status: Active")
|
|
SORT file.name
|
|
```
|
|
|
|
### All Projects with Status
|
|
```dataview
|
|
TABLE status, type, last_updated
|
|
FROM "Projects"
|
|
WHERE status
|
|
SORT status DESC, file.name
|
|
```
|
|
|
|
---
|
|
|
|
## 📝 Research Summaries
|
|
|
|
### Recent Summaries
|
|
```dataview
|
|
TABLE date, source_url
|
|
FROM "Summaries"
|
|
WHERE date
|
|
SORT date DESC
|
|
LIMIT 10
|
|
```
|
|
|
|
### Summaries by Tag
|
|
```dataview
|
|
TABLE date, source_url
|
|
FROM #security OR #ai OR #infrastructure
|
|
WHERE date
|
|
SORT date DESC
|
|
```
|
|
|
|
### By Source Type
|
|
```dataview
|
|
TABLE date, type, tags
|
|
FROM "Summaries"
|
|
WHERE type
|
|
SORT type, date DESC
|
|
```
|
|
|
|
---
|
|
|
|
## 🤖 OpenClaw Configuration
|
|
|
|
### OpenClaw Notes
|
|
```dataview
|
|
TABLE category, status, date
|
|
FROM "OpenClaw"
|
|
SORT date DESC
|
|
```
|
|
|
|
---
|
|
|
|
## 📅 Daily Notes (if you create them)
|
|
|
|
### Daily Notes Calendar
|
|
```dataview
|
|
CALENDAR date
|
|
FROM "memory"
|
|
WHERE date
|
|
```
|
|
|
|
---
|
|
|
|
## 🔍 Search Examples
|
|
|
|
### Find Notes Without Tags
|
|
```dataview
|
|
LIST file.name
|
|
FROM ""
|
|
WHERE !file.tags
|
|
SORT file.name
|
|
```
|
|
|
|
### Recently Modified Files
|
|
```dataview
|
|
TABLE file.mtime AS "Modified"
|
|
FROM ""
|
|
WHERE file.mtime > date(today) - dur(7 days)
|
|
SORT file.mtime DESC
|
|
```
|
|
|
|
### Notes by Category
|
|
```dataview
|
|
TABLE category, status, date
|
|
FROM ""
|
|
WHERE category
|
|
SORT category, file.name
|
|
```
|
|
|
|
---
|
|
|
|
## 🛠️ Custom Queries
|
|
|
|
### Broken HA Automations (needs attention)
|
|
```dataview
|
|
LIST
|
|
FROM "Home Assistant"
|
|
WHERE unavailable_count > 0
|
|
```
|
|
|
|
### Active Configurations
|
|
```dataview
|
|
TABLE category, date, config_file
|
|
FROM ""
|
|
WHERE status = "active"
|
|
SORT category
|
|
```
|
|
|
|
### Research by Date Range
|
|
```dataview
|
|
TABLE date, type, source
|
|
FROM "Summaries"
|
|
WHERE date > date(2026-02-01) AND date < date(2026-03-01)
|
|
SORT date DESC
|
|
```
|
|
|
|
---
|
|
|
|
## 🎯 Quick Reference
|
|
|
|
| Query Type | Syntax |
|
|
|------------|--------|
|
|
| **List** | `LIST FROM "folder" WHERE condition` |
|
|
| **Table** | `TABLE col1, col2 FROM "folder"` |
|
|
| **Sort** | `SORT column ASC/DESC` |
|
|
| **Limit** | `LIMIT number` |
|
|
| **Where** | `WHERE field = "value"` |
|
|
| **Group** | `GROUP BY field` |
|
|
| **Tags** | `FROM #tag1 OR #tag2` |
|
|
|
|
---
|
|
|
|
## 📝 Adding Frontmatter to New Notes
|
|
|
|
Use this template:
|
|
```yaml
|
|
---
|
|
title: Your Note Title
|
|
category: Category Name
|
|
status: active/inactive/completed
|
|
date: YYYY-MM-DD
|
|
tags: [tag1, tag2, tag3]
|
|
---
|
|
```
|
|
|
|
---
|
|
|
|
*Create your own queries by copying these and modifying!*
|