Obsidian DataView
= this.title
π
= ("[Website](" + this.url + ")")
| = ("[Source](" + this.source + ")")
| = ("[Documentation](" + this.docs + ")")
= ("> " + this.desc-short)
- Obsidian Example Vault for Dataview Queries | Demo Website
-
Omit “File” Column in TABLE results @ObsidianForum
1 2 3
TABLE WITHOUT ID col1, col2, ... ...
Metadataπ
YAML Front Matterπ
Most metadata should go in the (YAML) front matter of a note. The structure used therein will determine how data is presented in a rendered DataView query.
Inlineπ
You can add data inline as [curry:: Thai] with curry:: Katsu
or [curry: ]
or hiding the long key output in Reading mode (cake:: SchwarzwΓ€lder Kirsch)
I love = this.curry
curry and = this.cake
cake
Implicit Fieldsπ
Automatically added fields, collected under file
1
Table of available fields
Field Name | Data Type | Description |
---|---|---|
file.name |
Text | The file name as seen in Obsidians sidebar. |
file.folder |
Text | The path of the folder this file belongs to. |
file.path |
Text | The full file path, including the files name. |
file.ext |
Text | The extension of the file type; generally md . |
file.link |
Link | A link to the file. |
file.size |
Number | The size (in bytes) of the file. |
file.ctime |
Date with Time | The date that the file was created. |
file.cday |
Date | The date that the file was created. |
file.mtime |
Date with Time | The date that the file was last modified. |
file.mday |
Date | The date that the file was last modified. |
file.tags |
List | A list of all unique tags in the note. Subtags are broken down by each level, so #Tag/1/A will be stored in the list as [#Tag, #Tag/1, #Tag/1/A] . |
file.etags |
List | A list of all explicit tags in the note; unlike file.tags , does not break subtags down, i.e. [#Tag/1/A] |
file.inlinks |
List | A list of all incoming links to this file, meaning all files that contain a link to this file. |
file.outlinks |
List | A list of all outgoing links from this file, meaning all links the file contains. |
file.aliases |
List | A list of all aliases for the note as defined via the YAML frontmatter. |
file.tasks |
List | A list of all tasks (I.e., \| [ ] some task ) in this file. |
file.lists |
List | A list of all list elements in the file (including tasks); these elements are effectively tasks and can be rendered in task views. |
file.frontmatter |
List | Contains the raw values of all frontmatter in form of key \| value text values; mainly useful for checking raw frontmatter values or for dynamically listing frontmatter keys. |
file.day |
Date | Only available if the file has a date inside its file name (of form yyyy-mm-dd or yyyymmdd ), or has a Date field/inline field. |
file.starred |
Boolean | if this file has been starred via the Obsidian Core Plugin “Starred Files”. |
Queriesπ
- Types:
LIST
,TABLE
,TASK
andCALENDAR
, see query types. - Fields
- simple metadata
myfield AS "Field"
- use functions
("[[" + dateformat(date,"yyyy-MM-dd") + "]]") AS "Date"
- tags: use
join
to merge tags array into one string and prevent each showing up on a separate line (in a table):(join(file.tags)) AS "Tags"
- simple metadata
- Note source:
FROM
- tags:
FROM #tag
- folders:
FROM "mydir"
- incoming link:
FROM [[Note 1]]
- outgoing link:
FROM outgoing([[Note1]])
- exclude notes:
FROM "dir1" AND -"dir1/subdir"
- issues
-
relative paths not yet supported without JS, see issue, but this should work
1
WHERE file.folder = this.file.folder
-
- tags:
- Filter metadata:
WHERE
- partial match:
WHERE contains(field,"value)"
- created within last dat:
WHERE file.ctime >= date(today) - dur(1 day)
- partial match:
- Sort results:
SORT
- by modification date:
Sort file.mtime DESC
- by modification date:
- Group results:
GROUP BY
- Limit results:
LIMIT value
Inlineπ
See documentation on inline DQLs:
- data from other notes can be accessed with
=[[otherNote]].file.name
Exportπ
HTML from rendered DataView queries can be accessed through Obsidian development tools, e.g. ctrl+shift+i.
Functionsπ
https://blacksmithgu.github.io/obsidian-dataview/reference/functions/
DataView uses Luxon tokens for time formatting.
1 |
|
Javascriptπ
1 |
|
Examplesπ
Dataview task and project examples
- a task
Query for all tasks in this file
1 2 3 4 |
|
1 2 |
|
Calendarπ
HTML link from metadata1
1 2 3 |
|