DataView in Obsidian: turn notes to DB

Turn notes to a data and DB.
DataView in Obsidian: turn notes to DB

In the realm of note-taking and knowledge management, Obsidian has emerged as a powerful tool that offers a unique blend of flexibility and functionality. One of its standout features is the DataView plugin, which allows users to query their notes in a structured manner, akin to a database. DataView offers a way to bring code-like functionality into your note-taking workflow.

Core Features

Table and List Views

DataView allows you to display your notes in table or list formats based on metadata. This is particularly useful for creating dashboards or summaries.

table time-played, length, rating
from "games"
sort rating desc

list from #game/moba or #game/crpg

Data model

Dataview generates data from your vault by pulling information from Markdown frontmatter and Inline fields.

Yaml headers

Markdown frontmatter is arbitrary YAML enclosed by — at the top of a markdown document which can store metadata about that document.

---
alias: "document"
last-reviewed: 2021-08-17
thoughts:
  rating: 8
  reviewable: false
---

Inline fields

Inline fields are a Dataview feature which allow you to write metadata directly inline in your markdown document via Key:: Value syntax.

# Markdown Page

Basic Field:: Value
**Bold Field**:: Nice!
You can also write [field:: inline fields]; multiple [field2:: on the same line].
If you want to hide the (field3:: key), you can do that too.

Query Language

The plugin comes with its own query language that enables you to perform complex queries on your notes. This is a feature that would resonate with developers, as it brings a SQL-like experience into your note-taking.

DQL

Dataview Query Language (DQL): A pipeline-based, vaguely SQL-looking expression language which can support basic use cases. See the documentation for details.

TABLE file.name AS "File", rating AS "Rating" FROM #book

JS API with DataviewJS

you dont need to lear new language if you know JS. DataviewJS:A high-powered JavaScript API which gives full access to the Dataview index and some convenient rendering utilities. Highly recommended if you know JavaScript, since this is far more powerful than the query language

for (let group of dv.pages("#book").where(p => p["time-read"].year == 2021).groupBy(p => p.genre)) {
	dv.header(3, group.key);
	dv.table(["Name", "Time Read", "Rating"],
		group.rows
			.sort(k => k.rating, 'desc')
			.map(k => [k.file.link, k["time-read"], k.rating]))

Inline and data power

You could do a template like data injections with inlined data queries

This page was last modified at `$= dv.current().file.mtime`.

Dynamic Updates

DataView queries are dynamic. This means that as you add or modify notes, the DataView output will automatically update to reflect these changes.

How I use it

Reading insides

I pair it with a Kindle import plugin and have a View of all kindle hightlite over a day or week

table kindle-sync.title as title , kindle-sync.highlightsCount as count from "library/kindle" 
where kindle-sync.lastAnnotatedDate >= date(today) - dur(7 day)
SORT kindle-sync.highlightsCount descending

same for clipping from the internet

TABLE from #clippings where date(clipped) >= date(today) - dur(7 day)

Zettelkasten new ideas

I keep track of new ideas together with new reading to make sure that i process all

	TABLE file.tags from "sliperbox" where file.ctime >= date(today) - dur(7 day)

TODO tasks

Simple task management. Now i use more kanban boards but some times it is nice to have it ads table


Write a comment
No comments yet.