Can you use templater in dataview "Where" query

What I’m trying to do

I’m a newbie! But I’m trying to create a list of “Meetings this week” in my weekly note template, where it would list the meetings that occurred during that specific week.

Things I have tried

I’ve been trying to accomplish this with dataview and templater.

List 
From "Work"
Where date >= date(today) - dur(1 week)
sort date desc

^ this shows the current, updating week. I want the dates to be generated when the weekly note is made, showing that specific week.
I found this block in another forum post, but its throwing errors, and I don’t understand it enough to know why (below)

List
From "Work"
Where file.day >=date({{monday:YYYY, MMM DD}}) AND file.day <=date({{sunday:YYYY, MMM DD}})
sort date desc

So my question is, can I use templater to make the date generate when I use the template? How would I format it with the WHERE command in dataview?
Here is my best attempt, but the templater commands fail.

List
From "Work"
Where date >= date(<% tp.date.weekday("YYYY, MMM DD", 0 %>)) - date(<% tp.date.weekday("YYYY, MMM DD", 7 %>))
sort date desc

Thank you!

I’ve just figured the same thing out myself! I am creating a habit tracker table within my weekly notes that displays different pieces of metadata – but limiting the data to only the notes created in the current week.

If you put the following in a template:

WHERE file.cday >= date("<% tp.date.weekday('YYYY-MM-DD', 0) %>") AND file.cday < date("<% tp.date.weekday('YYYY-MM-DD', 7) %>") 

This should be the functionality you’re looking for. Adding quotation marks around the Templater command actually runs it as a Templater command.

If you put that statement in a normal note (i.e. not in a Template, and create a new note from that), then you will get no results – that was the issue I couldn’t figure out!

I should say as well that I used file.cday to get the day the file was created, but you would replace with date using the code you pasted in your question.

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