Help trying to get dataview to pull from YAML for the next 7 days from daily notes

Things I have tried

I have templater configured for both weekly and daily logs, I have also setup some front matter to capture a daily summary and what I would like to do is pull those daily summaries into my weekly log via a dataview query.

Front Matter has summary setup, daily notes are configured in their own folder with title as date format of YYYY.MM.DD.

Tried using the following based on some other queries but I am stuck, still learning obsidian and not much of a programming background.

FROM "04_daily Logs"
WHERE >= this.file.cday + dur(7 days)
sort file desc

Thanks for any help or insight.

To start: YYYY.MM.DD ins’t a valid date format; you need to use YYYY-MM-DD.
Second point: is a string, not a date type; even if the title is in YYYY-MM-DD format, if you call the you get a string, not a date.
In this cases you can use two ways:
a) apply a date() function to the - date(
b) when in title there’s a date in YYYY-MM-DD or YYYYMMDD you can use the implicit field - Data Annotation - Dataview

You can make date comparisons only if the values in stake are in a recognized date format or are an implicit date fields (as file.cday,, file.mday, etc).

Thanks for the quick response and help @mnvwvnm

I will update my template date format and then update my query.

I was able to get it working based on your suggestions. Thanks for the help @mnvwvnm

*** Solution:
Renamed the files to use the YYYY-MM-DD format, then updated the query as noted below.

The output now displays what I am looking for.

Table Summary, keywords AS "keywords"
FROM "04_Daily Logs"  
WHERE >= this.file.cday + dur(7 days) AND Summary
AND date( <
Sort desc

hmmm. I don’t understand this part:

  • WHERE >= this.file.cday + dur(7 days) AND Summary AND date( <

1 - is a string
2 - this.file.cday + dur(7 days) gives you a date
3 - <string> >= date doesn’t work!

If your Daily notes title are in format YYYY-MM-DD and the note where you run the query have the same title format, you can use
WHERE >= this.file.cday + dur(7 days) AND Summary AND <

If you want to use the, to be valid as a date you need to use date( in both places, not only in the second.

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