Obsidian Dataview
Tip
Use
LISTquery andtypeof()function to facilitate debugging! Make sure types are compatible!
Metadata
- Use inline metadata to include metadata semantically. e.g.
I would rate this film as \[rating:: 9\]. (ignore backslash) - Bracketed inline metadata is the only way to annotate a list item such as todo.
- Combined with inline tags and
TASKquery, this can be used for task management. Compare with obsidian-tasks
Query Commands
- To reformat the date, use
date(file.cday, "yyyy-MM-dd")— note that this function does not takearray.
Data Commands
GROUP BY
- An Introduction to Dataview - Part 1,
the
GROUP BYcommand. - When grouped, the table becomes a nested structure, to get the rows we
want, we use
rows.file.nameto access therowsobject. - To adjust elements within the
rowsobject, usemap()function. See mooc-catalog for an example.
map(rows.file.cday, (x) => dateformat(x, "MMM, dd")) AS "Date"flat(rows.file.etags) AS Tags,SORT
- To sort notes within each group while using
GROUP BY, make sure to putSORTcommand beforeGROUP BYcommand. See mooc-catalog for example.
WHERE
- In filtering
booleanfields,nulltype is treated asfalse. Filternullitems out first if necessary. See dashboard for example.
Functions
- Note that, some functions does not take
arrayas input, they can’t be used onrowsobjects.