Dataview query to list all meetings for a date literal

What I’m trying to do

I am trying to include a dataview query in each of my daily notes to show the meeting notes for meetings that take place on the day in question. Here is my test query:

LIST file.day FROM "Meetings" WHERE file.day = date(2023-12-18) SORT file.day ASC

The meeting notes are saved in a folder called “Meetings” with files named like so: 2023-12-18 Project launch

The query is almost there. Where it fails is in the date comparison logic–it returns nothing, rather than the single meeting on that day. I’m sure that I am missing something small but critical…

Things I have tried

I have tried various near-neighbor queries. For example, changing the file.day = date(2023-12-18) to file.cday = date(2023-12-18) works as expected. However, I don’t always create meeting notes on the day of the meeting, so I really want to pull based on the date in the meeting title.

Hello @ato, welcome to the Obsidian community!

I tried something similar to your query in my vault and it worked just fine:

```dataview
LIST file.day 
FROM "Inbox"
WHERE file.day = date(2023-12-21)
```

This leads me to wonder if the issue isn’t with your query but with your data. Some diagnostic questions:

  • Is the “Meetings” folder at your vault’s top-level directory?
  • Do your file names contain the date in YYYY-MM-DD or YYYYMMDD format as required by file.day?
  • Do you have a “Date” field inside the file that might be overriding the title date?
  • What happens if you run a query like LIST file.day FROM "Meetings"? Do the files have the day field populated as expected?

Hope this points you in the right direction.

Craig

Thanks, Craig, for helping. I am glad to know that what I have in place SHOULD be working. But even more puzzled as to why it isn’t…

I have indeed looked at all of the things you mentioned:

  • The filename of each meeting file is in the format 2023-12-18 Project launch, so the required YYYY-MM-DD format is satisfied.
  • There is a date field in the YAML of each meeting file, but it contains the same date as the file name.
  • LIST file.day FROM "Meetings" shows the expected date next to each filename.
  • LIST FROM "Meetings" WHERE file.day SORT dile.day DESC lists every file in the top-level Meetings folder and sorts it in reverse order.

Does anyone else have any ideas why this doesn’t work? An alternate way of doing the same thing that might succeed?

Thank you!
Arik

OK, I’ve figured it out. My original query works fine except on notes where the date/time YAML parameter actually saves a time. For example, a file named 2023-12-18 Project Launch with this frontmatter is picked up by file.day = date(2023-12-18):

---
date: 2023-12-18
---

…but this fails to be picked up:

---
date: 2023-12-18T11:00:00
---

My best guess is that in the latter situation the more specific date with a time included populates file.day and therefore the equality test fails, because a date is not the same as a date at a specific time. Poking around in the documentation, I found the striptime() function which makes this query work:

LIST FROM "Meetings" WHERE striptime(file.day) = date(2023-12-18) SORT file.day ASC

And an even better formulation for use in a daily note is:

LIST FROM "Meetings" WHERE striptime(file.day) = striptime(this.file.day) SORT file.day ASC

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.