• date: 2023-08-16 01:39:20
  • tags: #obsidian #dataview

Obsidian Dataview

Basics

  • DW - Dataview
  • write query inside
1
2
\```dataview
\```
  • there are 4 types of DW queries
    • list

Query syntax

  • LIST|TABLE|TASK|CALENDAR
  • FROM - the location of notes you need (folder?)
  • WHERE - notes with this criteria
  • SORT - with sorting (asc/desc)
  • GROUP BY - to group notes (shows them under the subitem/subtitle)
  • LIMIT - how many notes to show

Types of query

List

  • to show the list of all notes from the vault
1
2
LIST
FROM ""
  • to show the list of all notes from the vault which have a name “Obsidian Dataview”
1
2
3
LIST
FROM ""
WHERE file.name = "Obsidian Dataview"
1
2
3
LIST
FROM ""
WHERE file.name = "Obsidian Dataview"
  • a list can show only name of the note and one piece of data (for example - creation time):
    • file.ctime - creation time of the file
1
2
3
LIST file.ctime
FROM ""
WHERE file.name = "Obsidian Dataview"
1
2
3
LIST file.ctime
FROM ""
WHERE file.name = "Obsidian Dataview"

Table

^b874d7

  • unlike the list, table can shows several pieces of data
  • to show the table with “creation time” and “tags” of all notes which have a name “Obsidian Dataview”
1
2
3
TABLE file.ctime, tags
FROM ""
WHERE file.name = "Obsidian Dataview"
1
2
3
TABLE file.ctime, tags
FROM ""
WHERE file.name = "Obsidian Dataview"
  • to show the table of all notes with tags “obsidian” and “dataview”
1
2
TABLE
FROM #obsidian and #dataview 
1
2
TABLE
FROM #obsidian and #dataview 
  • to show the table of 4 notes with tags “obsidian” with sorting by “creation time”
1
2
3
4
TABLE
FROM #obsidian
SORT file.ctime DESC
LIMIT 4
1
2
3
4
TABLE file.ctime
FROM #obsidian
SORT file.ctime DESC
LIMIT 4

Task

^50b525

  • to show the list of tasks (checkboxes) from the specific note (note “Obsidian Dataview”)
1
2
3
TASK
FROM ""
WHERE file.name = "Obsidian Dataview"
1
2
3
TASK
FROM ""
WHERE file.name = "Obsidian Dataview"
  • to show the list of uncompleted tasks (checkboxes) from the specific note
1
2
3
TASK
FROM ""
WHERE file.name = "Obsidian Dataview" and !completed
1
2
3
TASK
FROM ""
WHERE file.name = "Obsidian Dataview" and !completed
  • to show the list of tasks (checkboxes) from the specific note under the link to the note where they are from
1
2
3
4
TASK
FROM ""
WHERE file.name = "Obsidian Dataview"
GROUP BY file.link
1
2
3
4
TASK
FROM ""
WHERE file.name = "Obsidian Dataview"
GROUP BY file.link

Calendar

  • to show the calendar with notes that were modified (dates of then notes were modified)
1
2
CALENDAR file.mtime
FROM ""
1
2
CALENDAR file.mtime
FROM ""

DEMO

  • All stuff below is needed to demonstrate Dataview functionality; Most of the DW queries get this note itself;

  • Tasks here are needed to show tasks in [[#^50b525|the example with tasks]]

  • Task 1

  • Task 2

  • Task 3