Dataview plugin snippet showcase

Figured out how to pull only the weekday notes of the current week!

TLDR the part that filters for that is WHERE file.ctime >= date(today) - dur(date(today).weekday - 1 + "days")

TABLE 
	T.text AS "Task Text", 
	T.points AS "Task Points", 
	T.status as "Completed"
FROM "Daily Planner" 
FLATTEN file.tasks AS T 
WHERE T.text 
	AND T.points !=null
	AND file.ctime >= date(today) - dur(date(today).weekday - 1 + "days")

Essentially, I have a LOT of tasks and subtasks for work, and generally assign them a point value with
[points:: 1] on the task when I plan to complete them in the next week or so. So here I’m pulling a table of every task with a point value this week, how many points it’s worth, and whether I’ve finished it.

This date thing is working because .weekday converts the day of the week to an integer (Sunday = 0, Saturday = 6). So on each daily note, I need to subtract the duration of how many days we are into the week to have to search back for daily notes.

So on Wednesday, I want dates that are greater than or equal to today’s date - 2 days. Wednesday = 3, so that’s where you get date(today).weekday - 1.

If you wanted your week to start on Sunday instead, you’d just remove the -1

1 Like