Automatically fill dates in dataview query for all files created in a week

I have the following dataview query that I use in weekly reviews to list all files created that week:

TABLE
dateformat(file.ctime, "dd-MM-yyyy HH:MM") AS Created
WHERE file.cday <= date(2023-01-22) AND file.cday >= date(2023-01-16)
SORT file.ctime

The query does exactly what I want, except for that I have to change the dates manually each week. Currently, the query is in a template for the weekly reviews and the template contains dates like in this example. I’d like to have the query template in such a way that I don’t have to manually change the dates anymore.

Is there a way to change this template so that the first and last day of the week are automatically filled with the correct dates? Or is there a way to give the query a week number so that it determines by itself what dates ar in that week? I saw in the dataview documentation that files have file.cdate and file.ctime attributes but no direct attributes for the week number and I’m a bit lost on how to let the query know what dates are in a week.

This, perhaps

```dataview
TABLE
dateformat(file.ctime, "dd-MM-yyyy HH:MM") AS Created
WHERE file.day.weekyear = this.file.day.weekyear AND file.day.year = this.file.day.year
SORT file.ctime
```

That listed all my files, but inspired me to search the dataview documentation for ‘dates’ and I found the solution I’m looking for (Literals - Dataview):

TABLE
dateformat(file.ctime, "dd-MM-yyyy HH:MM") AS Created
WHERE file.cday <= date(eow) 
AND file.cday >= date(sow) 
SORT file.ctime
4 Likes

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