Dataview plugin snippet showcase

That produced no results so clearly my naming convention for daily files isn’t recognised. I have tried creating files with various date formats for the filename but none seem to work. Weird !

Does anyone else suddenly have a lot of extra empty space between rows in a dataview table … ? Everything is up 2 date, without a custom skin or snippets.

1 Like

Well … not suddenly … I have always had way too much space bewteen rows in a table. I mostly use lists because of it.

So, I’m having sooo much trouble with contains, can somebody help please…
in my notes I have…
## Metadata Authors:: [[Justin Erik Halldór Smith]] ItemType:: [[Blog post]]
and I’m tring to get a dataview of those blog posts, or websites, or magazines, etc. I have this dataview
TABLE Title, ItemType, Date from "Zotero mdNotes" WHERE ItemType SORT desc
which gives me this…

But I cannot for the life of me (been at it all day today) get it to produce a table of just the blog posts.

Any ideas?

I’m a huge fan of Conan the Barbarian comics, so I’ve started cataloging them. I’ve barely made a dent - I have more than 1,100 more to process. Plus I’m building a compendium of recurring characters, important places, and notable objects. It’s a big project! But I’m re-reading each issue as I catalog them, so I’m having lots of fun :nerd_face:


I’ve just started playing around with Dataview and I am having problems with thousands separators (comma’s) in numbers.
I have in-line numbers like 1,234 which are read as two separate numbers 1 and 234.
If I make it 1234 it’s all good but it’s hard to read with large numbers. The only way I’ve found to preserve them is using quotes but then the output is not a number and I can’t do any calculations with it. Even if I could format the output correctly that would be a win.

1 Like

Sure. Basically, I have a folder People/Friends & Family where I put my TOC (Table of Contents) file and the single people’s notes.

In my “TOC” note, I have a leaflet map, centered on a theoretical “midpoint” of Germany, so I get a nice view, plus a list of people:

tags: friends, family



# Friends & Family TOC
This is the Table of Contents of your friends & family.

height: 500px
lat: 51.133333
long: 10.416667
minZoom: 1
maxZoom: 18
defaultZoom: 5

The list is sorted by last modified time, newest at top.

table birthday as "Birthday", file.ctime as Created, file.mtime as "Last modified"
from "People/Friends & Family"
where !=
sort file.mtime descending

You can then create some different markers in the settings of Obsidian leaflet (check Docs): I made “Friends”, “Family” and “Location” under Additional Map Markers.

Then simply zoom into the map, right-click and create new markers, specifying the map marker type and the linked note, or (quite cumbersome still)

  • export the current leaflet data csv,
  • add entries manually (people notes referred to must already exist), and
  • import the CSV again.

The CSV basically looks like this (check docs):

People/Friends & Family/+Friends & Family,Family,51.133333,10.416667,Matthias C. Hormann,,
People/Friends & Family/+Friends & Family,Friends,51.133333,10.416667,Friend 1,,
People/Friends & Family/+Friends & Family,Location,52.52134162768218,13.41327381161729,Berlin Weltzeituhr,,3f4981d8-1615-4905-9cc4-e4df122215be

If you leave out the GUID in the last column, it gets created by Leaflet automatically. The locations given here are fake values, of course (except for the “Weltzeituhr” in Berlin).

You may need to refresh the note containing the map after import, to make it show all markers.

My “people” notes are really simple and just have the “calculated” links at top:

location: [51.133333,10.416667]
birthday: 1970-07-11
tags: friends

[[+Friends & Family TOC]]

`= elink("" + this.location[0] + "," + this.location[1], "Google Maps")` `= elink("" + this.location[0] + "," + this.location[1], "Street View")` `= elink("" + this.location[0] + "," + this.location[1], "Route")`


# Friend 1
\* `= this.birthday` (`= (date(today) - this.birthday).years + " Jahre"`)

This will later have the correct links and look like this:

Clicking on the “Route” link, for instance, then opens the Google Route Planner in your browser (from which you could click “Send to my smartphone” and get instant navigation):

Hope that helps!


As of version 0.2.17 the tables are back to normal for me. At version 0.2.14 it was “bugged” and a lot of extra space was between rows in a table.

I like your use of Birthdays. Now I want to add a dataview of upcoming dates on my daily notes. No clue how to write that though. Any dataview ninjas have any ideas?

Before I post as a bug in Github, can someone do a quick test?
in frontmatter I have
- - -
datecreated: 2021-04-27
- - -

In a dataview rule I’m trying to use that field: I’ve tried
list “Film/Film Titles”
where datecreated=2021-04-27
where datecreated=“2021-04-27”
where contains(datecreated, “2021-04-27”)
where contains(datecreated, 2021-04-27)

Keep getting 0 results.

Well, it’s possible but really clumsy due to the restricted syntax of Dataview. I wish we had “real” SQL syntax and/or JS.

Let’s say we want a “upcoming birthdays” table for the next two months from now. Crossing year boundaries must be possible (i.e., if you are in December, you also want the January birthdays), and the list sorted. Also, you want to show what birthday it will be.

Warning: This is not elegant, rather clumsy, relies on numerical computations and lots of repeating calculations! This isn’t production-quality code, but just a proof of concept.

You will have to change the desired duration to show in three places in the dataview code block (look for dur(2 months)).

### Upcoming Birthdays

Here are the upcoming birthdays for the next 2 months (until `=date(today) + dur(2 months)`).
table birthday as "Birthday", choice(
date(today).month*100+date(today).day = birthday.month*,(date(today)-birthday).year,(date(today)-birthday).year+1) as Turns
from "People/Friends & Family"
where != and
choice(date(today).month*100+date(today).day > birthday.month*,
(date(today).year+1)*10000 + birthday.month*100 +,
date(today).year*10000 + birthday.month*100 + <= (date(today) + dur(2 months)).year*10000+(date(today) + dur(2 months)).month*100+(date(today) + dur(2 months)).day
sort choice(
date(today).month*100+date(today).day > birthday.month*,
(date(today).year+1)*10000 + birthday.month*100 +,
date(today).year*10000 + birthday.month*100 +

It will look like this:

Have fun! (And hope for a combined SQL and Javascript engine.)

If anyone knows how to simplify this horrible code (and retain full functionality), please let us know!


Try datecreated= date(2021-04-27)
; )

1 Like

@rupadarshiray Thanks so much, that did the trick!

1 Like

This looks great to me! I presume we need to change the ‘red’ bits for our own purpose? “People/Friends & Family” is a folder, yes?

I am however even less clear what ‘choice’, or ‘date’ should be changed to - hold my hand please!

1 Like

This should work, although I don’t know if you would have to include the square brackets:
where contains(ItemType, "Blog post")

Yep, “People/Friends & Family” is a folder, but you could use any other legal “from” constructs here like “#people” or whatever.

Disregard the “red bits”—this is just forum code formatting and doesn’t mean anything in this case.

The “choice” constructs are mainly to find if a birthday is already in the past for this year, and to construct different values for the numeric addition (it forms numerical pseudo-dates in the form YYYYMMDD and MMDD for the “birthday is in the past” comparisons).

Regarding the date(today): Yes, it calculates from “now”. If you’d need something else as a reference, like maybe the date part from the file’s title (in case of daily notes), you’d have to make careful changes throughout. And test a lot. :slight_smile:

Thanks for trying Lise, it is still not working for me. I think I will take a break from this one now… it is vexing me something chronic.

Scratch that: I got it working. Very weird tho… cutting’n’paste-ing the field: value from one of the original docs made it work (I also jiggled with the formatting). So the issue must have been some stray non-printing character , or some thing (gremlin?)

TABLE Title, ItemType, Year
FROM #zotero  
WHERE ItemType=[[Blog post]]
SORT desc

Boom! I got this one working. Many thanks for your work Moonbase59, much appreciated.


I have just discovered this plugin and have been playing with it to create a kind of TOC for my literature notes. It’s awesome.

Currently, my table looks like the picture, and my query is

TABLE author as Author, title as Title, tags as Topic
WHERE contains(, "@") and area = "medieval" and type = "secondary"
sort author asc

(all my lit notes start with “@” in the filename).

I would like to do the following but not sure if it’s possible – does anyone know?

The first, “File” column of the table with the file names is not very informative for my purposes (I name the lit notes by the appropriate bibtex citekey). Is it possible to not have that column at all, and link to the files by one of the other columns, let say, by the title? – This is mostly a cosmetic issue, but then the table would have more space for the other things that are important.

Again, this is a great plugin, I have been using it a lot for all kinds of tables and lists :slight_smile:


For removing the first file column, you can add this to your css snippets,

.dataview.table-view-table th:first-of-type,
.dataview.table-view-table td:first-of-type{
    display: none;

As to having another column link to the file, I don’t know a way yet. The only thing that returns a link from the query is but that still shows the file name which you don’t want.