Dataview — Returning a specific daily note

What I want to do

I want to use Dataview to return today’s daily note file on my “home” note.

Things I have tried

I’m attempting to do this via searching for the name, which uses the following format — YYYY-MM-DD-dddd

Here’s the Dataview code I’m attempting to use…

dataview
List FROM "Daily Notes" 
WHERE file.name = dateformat(date(today), "YYYY-MM-DD-dddd")

However, I continue to get a “Dataview: No results to show for list query.” return.

I’m still very new to Dataview and Obsidian and have searched the forums and Google, but I’m still struggling to figure out this issue.

One error and one tip:

  • Dataview uses Luxon for dates format (luxon/formatting.md at master · moment/luxon · GitHub). As you can see you’re not using the correct tokens - pay attention to upper / lower cases - for example DD is different from dd
  • if you’re using a title with the format “YYYY-MM-DD something else or not”, then you have an implicit field called file.day, an explicit date associated with the file title (see docs). I.e., you have automatically a valid date (not a string, as in file.name) to compare with other dates.

So, basically you only need something like WHERE file.day = date(today)

This?

`=link(dateformat(date(today), "yyyy-MM-dd-EEEE"))`

The other great guys, have given you some suggestions as to why it doesn’t work as you intended it to with the following script:

I’m only here to give you an alternate query, which could have helped you identify the culprit/errors/features/… of your query.

```dataview
TABLE WITHOUT ID file.name, dateformat(date(today), "YYYY-MM-DD-dddd")
FROM "Daily Notes"
```

I often find myself doing table queries like this, especially if I’m unsure on what to do with the WHERE section. I then just add the fields I’d like to use in the WHERE section, as columns in the query, to check that they actually holds the value I’m expecting them to.

This can help me identify various errors, like in your case the date format, and in some other cases whether the field you’re wanting to check is a link, or just a string, and so on.

If the output is overwhelming, you could toss a LIMIT 30 (or similar) at the end of the query to limit the amount of entries returned.

Hope this helps with debugging future queries! :smiley:

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