Skip to content

Tracking notes created in Obsidian with Dataview

Published:

3 min read

My daily note is the starting point for capturing workday information. To record this information, I either create a fleeting note or add it to my daily note. Creating too many new notes can be cumbersome and overwhelming at the end of a week when I’m going through them for my weekly review sessions.

To quickly go through the notes created during the week, I do this by keeping track of the files created each day inside that day’s daily note.

At the end of each daily note, I include a section for “Notes created today”. Inside this, a live data query runs which provides a list of notes created on that day. The query links to the note titles using Obsidian’s link [[...]] syntax.

Here’s an example of today’s notes listed in the daily note:

Graph view in Obsidian

The Dataview plugin runs the data query inside the callout.

Prerequisites

Install the following Obsidian plugins to follow the instructions further:

In the Daily note and Dataview plugin, I’ve set the date format to be YYYY-MM-DD:

Graph view in Obsidian Graph view in Obsidian

What is the Dataview plugin

Dataview is an Obsidian plugin that allows you to query metadata in real-time from files or folders within your vault. It lets you create dynamic lists, tables, and views of your notes based on their metadata.

For example, to list all of your notes in the Obsidian vault, use the following syntax:

```dataview
LIST
```

The Dataview plugin supports writing queries with the Dataview Query Language (DQL) or as inline statements. For more complex queries, you can also use JavaScript.

For the purpose of this post, using the Dataview Query Language is enough.

Using a query to view a list of notes created for a date

Notes created each day can be viewed using the following query:

```dataview
LIST
WHERE file.cday = this.file.day
SORT file.ctime asc
```

If you are new to this syntax, it might initially seem confusing. Let’s break down the components of the query:

While the query effectively lists files created on a specific date, it also includes files from the ‘Daily notes’ and ‘Templates’ folders, which is useless for my use case. To exclude files from those folders, update the query as follows:

```dataview
>LIST
>WHERE file.cday = this.file.day
>WHERE !contains(file.path, "Daily notes/")
>WHERE !contains(file.path, "Templates/")
>SORT file.ctime asc
```

In the updated query, the contains function checks the path of the file (file.path) inside the directories (Daily notes/ and Templates/). Using the ! operator, any file in those directories is excluded from the Dataview query. This helps me avoid listing files I don’t want to see inside this Dataview.

Conclusion

Metadata is powerful in Obsidian notes. What’s even more powerful is the ease of using metadata fields to create custom views with the Dataview plugin.

References

I'm a software developer and a technical writer. On this blog, I write about my learnings in software development and technical writing.

Currently, working as a documentation lead at Expo.