Dataview
sublimated renders Obsidian Dataview DQL queries as live tables and lists. no plugins needed — queries evaluate server-side when the page loads.
code block queries
wrap DQL in a dataview fenced code block:
```dataview
TABLE date, purpose
WHERE date
SORT date DESC
```queries run against all files in the current folder. each file's YAML frontmatter fields are available as columns.
inline expressions
use `= expr` anywhere in text or markdown tables for computed values:
total files: `= length(rows)`
countries: `= length(unique(filter(flat(rows.tags), (t) => startswith(t, "country/"))))`inline expressions have access to rows — all sibling files in the current folder.
query types
TABLE
renders as an HTML table. first column is always the file link.
LIST
renders as a bullet list with file links.
operations
operations apply in the order written:
WHERE condition— filter rowsSORT field ASC|DESC— sort rows (multiple fields supported)LIMIT n— cap number of resultsFLATTEN field AS alias— expand array fields into separate rowsGROUP BY expr AS "Label"— group rows, access group items viarowsvariable
GROUP BY
groups all matching files by expression. each group becomes one row with rows containing the grouped items:
access grouped data: rows.file.name gives array of file names in the group, flat(rows.tags) flattens all tags.
FLATTEN + GROUP BY
combine FLATTEN and GROUP BY for disaggregation/reaggregation:
this expands each file's country tags into separate rows, then groups by country name.
expressions
fields
file.name— filename without extensionfile.path— full pathfile.folder— parent folderfile.size— size in bytesfile.ctime— created timefile.mtime— modified timefile.link— link to the fileany frontmatter field —
date,tags,purpose, etc
operators
comparison:
=,!=,>,<,>=,<=arithmetic:
+,-,*,/,%logical:
AND,OR,!
lambdas
(x) => startswith(x, "country/")used with filter, map, sort, any, all, none.
functions
array
length(array)— count elementscontains(array, value)— check membershipfilter(array, lambda)— keep matching elementsmap(array, lambda)— transform elementssort(array)— sort elementsunique(array)— deduplicateflat(array)— flatten one level of nestingjoin(array, separator)— join to stringreverse(array)— reverse orderany(array, lambda)— true if any matchall(array, lambda)— true if all matchnone(array, lambda)— true if none match
string
contains(string, substring)— check substringstartswith(string, prefix)— check prefixendswith(string, suffix)— check suffixlower(string),upper(string)— case conversionreplace(string, from, to)— replace substringsplit(string, delimiter)— split to arrayregextest(pattern, string)— regex match test
date
dateformat(date, format)— format date (e.g."yyyy-MM-dd","yyyy")date(string)— parse string to datestriptime(date)— remove time component
math
round(n),floor(n),ceil(n)— roundingmin(array),max(array)— extremessum(array),average(array)— aggregation
utility
default(value, fallback)— null coalescingchoice(condition, ifTrue, ifFalse)— ternarytypeof(value)— type namestring(value),number(value)— type conversionlink(path, display)— create link
frontmatter
YAML frontmatter is automatically extracted and stored when files are pushed. string values that look like dates (YYYY-MM-DD) are parsed as date objects.
---
title: Japan 2024
date: 2024-03-15
purpose: tourism
tags:
- country/japan
- city/tokyo
- city/kyoto
---all fields are accessible in queries: WHERE date > date("2024-01-01"), SORT date DESC, etc.
limitations
queries only access files in the current folder (no cross-folder queries yet)
no FROM clause needed — defaults to current folder
FROM "subfolder"resolves relative to the current folderTASK and CALENDAR query types not supported
no custom JS views