Need help with calendar view to only show backlinks

Hello. Gonna try to describe this as best I can

My original intention

Basically I’ve got this page called “Did today” that I link to within my daily notes like so:

[[Did today]]: (And here I write a summary of what I did that day)

I often write the rest of the page, writing down my thoughts and feelings throughout the day, then at the end of the day I go back and add the above to the top to summarize what I did that day, or write down an anecdote. Anything I want to remember, which I started doing with the intention of going into the backlinks to retrieve the information all in one place and be able to copy it down into a physical notebook which I’m currently running from but do intend to continue writing in :')

Except, while the backlinks menu is fine and I can query the backlinks to show with context as a list if I want to (I made it work at one point I think, it wasn’t too hard), with a list like that it’s kinda hard to check at a glance whether I missed any days (which I am wont to do)

What I’m trying to do

I’d like to have Dataview display a calendar view inside the “Did today” page that only shows dots for the notes that link to it, that way I can quickly look at it and see if any days are missing a dot, preferably without having to add the date into the metadata of the notes (I am using the note title as the date)

Things I have tried

Currently I have only managed to make the calendar view display with ALL notes that have a date as their file name. Here is the code I’m using:

```dataview
CALENDAR date(file.name, "dd-MM-yyyy")
WHERE file.name

CALENDAR date(file.name, "dd-MM-yyyy")
WHERE file.inlinks

Either one works, which kind of worries me because I don't understand why they work in the first place (I also had a similar issue with a table I tried making where for some reason "FROM [[]]" gave me the file inlinks without me asking it to? Which I don't understand the reason for). And the issue is, whichever one I use, as I said, it shows me ANY page that has a title that goes dd-MM-yyyy

I've tried a bunch of different ways of formulating it, but they either give the same result as this, or they display an empty calendar, or they don't display anything at all. Occasionally I get an error message about formatting (this has happened anytime I tried to use 'FROM' in this context for instance)

I just. I'm at a loss as to how the calendar view works in this regard. It doesn't help that nobody really seems to be attempting to use it much - I've found very little help with this both on the Dataview info website and in these forums. I can't tell if I'm missing something

Sorry for the formatting, it’s my first time posting here and I didn’t notice the preview because of the pop-up thing on the right : /

With no FROM clause, Dataview is pulling in ALL the notes in your vault.


Try the following query (placed inside your “Did today” note).

```dataview
CALENDAR date(file.name, "dd-MM-yyyy")
FROM [[]]
WHERE date(file.name)
```

The FROM [[]]] clause, generates the set of all notes that link to the containing note (the note that contains the query).

WHERE date(file.name) filters this set for those notes that have a valid date as their filename.

Then CALENDAR date(file.name, "dd-MM-yyyy") uses the specified date expression as the key for constructing the calendar.

1 Like

Hi,
Thank you so much! For some reason, the change to WHERE date(file.name) makes it not show any results (just an empty calendar), but keeping WHERE file.name and just adding FROM [[]] solves it. I’m not sure why I didn’t try this before, however your explanation cleared up how FROM [[]] works for me I think, so I should be able to use it effectively from here on out. And it seems to work now with that addition! Ty very much!! :smiley:

Here’s the final query that seems to work so far:

CALENDAR date(file.name, "dd-MM-yyyy")
FROM [[]]
WHERE file.name

Last addition: Tried removing the line WHERE file.name and it works fine without it, so it’s probably not doing anything as is. Not sure why I included it originally

This is slightly incorrect or imprecise. This date(text, format) statement takes a string, namely the file name, and converts it into a date where the text is in the given format. It’s not formatting a date into a text with a given format, but it converts a text into a date which is what CALENDAR expects.

The WHERE date(file.name) will only accepts files where the file.name is in the IS08601 format, but the previous statement shows that the OP is actually using dd-MM-yyyy for their filenames. In this case, the WHERE statement would cause any of those files not to be included since they’re not in the ISO8601 format (of “yyyy-MM-dd”).

Using just WHERE file.name is almost similar to WHERE true, since most (if not all) file names are considered truthy. So it can safely be ignored. Using the FROM [[]] which limits to only files link to the current file is a wise move. One could consider adding the folder of the daily notes if that is used, or potentially WHERE date(file.name, "dd-MM-yyyy") to the mix, but it’s not given that any major speed up is experienced.