Useful Advanced Dataview Queries
Here I’ll walk through a couple of examples of elaborate Dataview queries that I use for my own vault, and I’ll explain their design.
1. Takeaways from talking to people I recently met
Imagine you’ve just had an insightful conversation, attended a networking event, or participated in a productive brainstorming session. You quickly jot down your thoughts in Obsidian. This is where Dataview comes in handy, helping you organize and retrieve these valuable insights efficiently.
Let’s build a Dataview query together. Here’s the final result - it’s a bit complex, but we’ll break it down:
LIST WITHOUT IDnotesPerPerson.file.linkFLATTEN (file.outlinks) as outlinkWHERE contains(meta(outlink).path, "people/")GROUP BY outlinkSORT min(rows.file.ctime) DESCLIMIT 20FLATTEN rows as notesPerPersonWHERE contains(notesPerPerson.file.path, "inbox")SORT notesPerPerson.file.ctime DESCLIMIT 20
So, let’s break it down.
How do I know if a link is a person?
... yesterday I talked to [[Jean Deaux]] about ...
In my vault, a link for “Jean Deaux” isn’t just a name—it’s a reference to a note in the “people” folder. When I meet someone new and mention their name in my notes, I create a new note for them in the “people” folder. This way, whether Jean appears in my “inbox” or another folder, they’re always linked to their profile in the “people” folder.
Identifying notes that refer to people
FLATTEN (file.outlinks) as outlinkWHERE contains(meta(outlink).path, "people/")
This part of the query identifies notes that contain links to files in the “people” folder, effectively finding mentions of people in your notes.
Focusing on recently met people
This part of the query helps prioritize recent connections:
GROUP BY outlinkSORT min(rows.file.ctime) DESCLIMIT 20
It finds your 20 most recently mentioned contacts. We could adjust this to focus on most frequently mentioned people or earliest mentions if needed.
Filtering to unprocessed notes
Sometimes we need time to process our quick notes. This part of the query helps us manage our unprocessed thoughts:
WHERE contains(notesPerPerson.file.path, "inbox")SORT notesPerPerson.file.ctime DESCLIMIT 20
It looks into your “inbox” folder (think of it as your digital notepad) and retrieves the 20 most recent unprocessed notes. It’s like having a helpful reminder system that says, “Hey, remember these people you recently met? You might want to follow up.”
This query acts as a smart organizer for your growing network, helping you keep track of new connections without overlooking anyone. It’s like having an excellent memory for social interactions, but with the added benefit of being systematic and effortless. 📊🤝
The final Enzyme block
```enzymesources: - dql: | LIST WITHOUT ID notesPerPerson.file.link FLATTEN (file.outlinks) as outlink WHERE contains(meta(outlink).path, "people/") GROUP BY outlink SORT min(rows.file.ctime) DESC LIMIT 20 FLATTEN rows as notesPerPerson WHERE contains(notesPerPerson.file.path, "inbox") SORT notesPerPerson.file.ctime DESC LIMIT 20guidance: | I have these in my inbox that I've quickly captured from catching up with friends, collaborations with colleagues, and new people I've met from events. I want to make it easier for me to revisit them, so please collect common ideas and help me prioritize following up on urgent threads. Additionally, identify any longer range ideas. Synthesize specific and recurring ideas that I took notes on, then structure it in sections for each idea with the following bullets: people names, insightful takeaways, potential next steps, and references to source material (avoid using the same ones twice)```
This query leverages two straightforward organizational habits: an inbox
folder for quick captures and a people
folder for contact management. It’s a practical approach that allows Dataview to retrieve relevant notes efficiently, even if your overall folder structure is relatively simple.
Moving on, let’s explore another useful example: synthesizing highlights from consumed content. This next query can help you extract value from your reading and listening habits.
2. Revisiting what I’ve read or listened to
I used to struggle with connecting ideas from different sources. It was easy to treat books and articles as just items to check off a list. But simply archiving them felt like wasting valuable insights.
Obsidian has helped me improve this process. Here’s my current setup:
- I save highlights from Kindle books, articles, and podcasts (using Snipd for transcripts) to Readwise.
- Obsidian’s Readwise plugin brings these highlights into my vault. Each source gets its own file, organized by date and highlight.
- I keep podcasts, books, and articles in separate folders.
Here’s a simple Enzyme block to help me review my recent content:
sources: - dql: | LIST FROM "Readwise/Podcasts" SORT file.ctime DESC LIMIT 3 - dql: | LIST FROM "Readwise/Books" SORT file.ctime DESC LIMIT 2 strategy: LongContentguidance: | These are my highlights from books and from podcasts, some of which contain my own notes. There is technical content as well as reflective content; usually, I want to keep them separate. Synthesize common introspective threads that resonated with me or technical implications that I found interesting, structuring your output into sections. Each section should have the following: a title, a description, and references.
I use something called LongContent
for my book highlights. I tend to highlight a lot in books, so this strategy helps by focusing on the most recent parts.
For podcasts, since they’re usually shorter, I let Enzyme look at all the highlights. It’s all about finding the right balance for different types of content!