Given that,
in the daily log file, there is a date key in meta.
---
date: <% tp.date.now("YYYY-MM-DD") %>
---
in the weekly report file, there is also a date key in meta.
---
date: <% tp.date.now("YYYY-MM-DD") %>
---
What I want to do is, when the weekly report is created from templates, all the daily log from last week should be listed in a table via dataview extension.
What I’m trying to do
a minimal working example would like
```dataview
list from "06 Logs"
where (date >= date(2022-03-15)- dur(7 days)) and (date <= date(2022-03-15) - dur(1 days))
where contains(tags, "DailyLog")
sort date desc
for the automatic generating, now I would prefer using date variable like
this.file.date , file.cday instead of the fixed explicit date like “2022-03-15
therefore, the ideal is likely to using
```dataview
list from "06 Logs"
let reportDate = this.file.date
where (date >= reportDate- dur(7 days)) and (date <= reportDate - dur(1 days))
where contains(tags, "DailyLog")
sort date desc
Of course, the above code doesn’t work, so I’m here to ask for a solution ::
I just found using this.file.day could be a workaround.
```dataview
list from "06 Logs"
where date >= this.file.day - dur(7 days)
where date <= this.file.day - dur(1 days)
where contains(tags, "DailyLog")
sort date desc
But to dig deeper, I can turn the question into
how to reference a meta from a specific file (e.g. this.file) in the dateview filed.
Hi.
You just need to use the format this.key (in your case, this.date).
Created fields are different from implicit fields: at page level the implicit fields have the prefix file but the created one not (unless the created fields are nested in other page-level field: for example an inline field inside a task).
where date >= this.date - dur(7 days)
where date < this.date
An extra: to see the structure of the metadata in a specific note, run this js inline query (enable js queries in settings > dataview)