Dataview plugin snippet showcase

I’ll try this one :v: if it works it will require to insert that new yaml element to all notes. IS that right?

Just to be sure, file.links is not a real property dataview can access. I use it as a hypothetical example.
But, like you say, if you added the links in the yaml frontmatter, you could get it to work in that way

Hey everyone - gradually getting up to speed with Obsidian and generally very excited about the possibilities that Dataview can bring.

I’m having some issues though with what I think should be a fairly basic use case. Basically I’m trying to avoid putting tags in the body of my content and placing them in the YAML instead.

Here’s what I’ve got so far (for book notes)


source: Ego Is the Enemy
author: Ryan Holiday
tags: [highlights]


table source, author
where contains(file.tags, "highlights")

Unfortunately though, Dataview isn’t finding anything. Can anyone point out what I’m doing wrong?

And as a secondary question, how I would need to amend my contains() function to match more than one tag?

Thanks hugely in advance!

I think you’re missing a from. Does the following work?

table source, author
from #highlights

Maybe it’s just me but I’ve found that using LIMIT for a query that sorts by date (asc/desc) won’t work. The query works/sort fine without it.

Another question: Is there a syntax to shorten the file.ctime output (ie: to just DD-MM)? I guess there is no default attribute such as

A few ways you could do this, last one is what I think you’re looking for.

  1. Extract the properties you care about from file.ctime using .day and .month into two different columns

So this:

table, file.ctime.month

Will give you this:

  1. Make a list of those two properties to have them in one column:

So this:

table list(,file.ctime.month) as creation

Will give you this:


  1. Use string concatenation to combine the relevant properties into one cell:

So this:

table + "-" + file.ctime.month as creation

Will give you this:



What an awesome plugin. Thanks for developing it.

I would like to achieve something really simple to print only mtime under the title of a note.

I tried

list file.mtime

But then I got a list of all notes and their mtime. It also shows the title of the note which is not necessary.

Is this is possible?

Hey Jan! I didn’t develop dataview, I’m just a big fan :grinning_face_with_smiling_eyes:

You can use this hacky way of doing it:

table rows.file.mtime as Modified
where =
group by

Will give you this table:


:smile: thanks for this.
It’s a bit much for what I want (space wise) so I continue my quest to find a way to add mtime as a single text string. If you run into something like that somewhere in the future please let me know!


I created an issue on GitHub because I thought dataview wouldn’t display all files in my inbox. Turned out it was a feature:

## Did you know …

… that dataview will only list non-empty files?

I had played around with my new Obsidian URI desktop shortcut to create new datetime-stamped note in your Inbox and created lots of empty test files and I use a “Inbox Table-of-Content” note that uses dataview but didn’t show all files:

table file.ctime, file.mtime
from "+Inbox"
where != "+Inbox TOC"
sort file.mtime descending

So now we know! :slight_smile:

EDIT: Turns out that after putting a single character into one of the empty files, it gets listed, but when removing it again (thus emptying the file) it still gets listed. Odd.

EDIT 2: Dataview 0.2.10 didn’t catch all events. This has been fixed in 0.2.13 and I could verify today (with 0.2.14) that the problem has gone.

This also means I was assuming the “empty file feature” (which isn’t true). Thanks @blacksmithgu for fixing it!

FWIW, you can do:

table rows.file.mtime as Modified where = group by

No need for the line breaks.

But, dataviews will only work using triple-backtick code fences, so you still need the opening ```dataview (and the closing triple-backticks).

Does any dataview wizard know if you can dynamically subtract dates between fields? I’m trying to create a table of my projects and how long they’ve taken. I’ve got “date-started” and “date-finished” YAML variables for my projects, but I can’t tell if you can create another column that dynamically tells you the duration of the project based on those two fields. I tried defining another variable “length” and subtracting date-started from date-finished, but that doesn’t seem to work.

table status, date-finished, date-started
from ""
where status
sort status desc

Sample note YAML:

status: complete
date-started: 2020-06-28
date-finished: 2020-08-29
length: date-finished - date-started
1 Like

Hey Janek. You should be able to use a computed field like so:

table (a - b) as NewField

In your example:

table status, date-finished, date-started, (date-finished - date-started) as Length
from ""
where status
sort status desc

4 posts were merged into an existing topic: Dataview, strange display

@SkepticMystic I’m just getting started with Obsidian and came across your amazing plugin - great work. I am interested in a roadmap feature you have mentioned “Hierarchical view”. Not sure what you have in mind but I thought I would describe a need I have in case its relevant. I would like to extract and visualise the hierarchy embedded in a group of notes - specifically each note is an entity (place, person, thing, etc) with a [[link]] to another entity inside it (in my case it is a simple parent-child relationship). I would like to be able to extract all of this and visualise it in a mind map view (similar to the Mind Map plugin). Is that compatible with your thinking?

Hey Simon :slight_smile:
This isn’t my plugin, I’m just a fan!
Regarding your question, I think what you have in mind could work! Checkout @arminta’s reply here, perhaps she can also give you some pointers.

1 Like

@blacksmithgu posted this on GitHub in reply to my question regarding displaying modified time in a note:

This is now possible via inline queries; just put an inline code block in your file:

`= this.file.mtime`



Also works for other things like …

Last modified: `= this.file.mtime`
Last modified date: `= this.file.mday`
Tags: `= this.file.tags`
Aliases: `= this.file.aliases`

Really great! :grinning:

Now we’ll only have to wait for …

  • date/time string formatting
  • date/time strings being localized into the currently set Obsidian language, not the system language

See Is it possible to specify a format when displaying a date? · Issue #120 · blacksmithgu/obsidian-dataview · GitHub


I watched your video today (thanks for that!). Re your section on “lists”. I could not get any of them to work and I don’t know if perhaps the last couple of updates broke it or if I’m doing something wrong. Presumably I should be able to write list fieldInYaml from "Folder" and get results, right?

With country: UK in my yaml, and list country from "Film/Film Titles" I get no results.

1 Like