DataView Question: How to program the week note

Things I have tried

On my daily note template I use dataview to show a list of tasks due that day. This is the code.

dv.taskList(dv.pages().file.tasks 
  .where(t => !t.completed)
  .where(t => t.text.includes("{{date:YYYY-MM-DD}}")))

What I’m trying to do

I also have a weekly note where I plan for the week and would like to include a list of tasks from that note in my daily note template. The title of that note has the syntax gggg-[W]ww eg. 2023-W05
Is there a way to write the code in my daily note template to include uncompleted tasks from the current weekly note automatically?

Thanks!

Are you trying to include the weekly note tasks in the same taskList that your daily note tasks are in?

Or are you trying to put a second, separate taskList in your daily note, that displays only your weekly note tasks?

Separate

It seems like you’re using the core template function, is that correct? If that is the case, I’m not sure how to do it, but the gist of it would be something like:

```dataviewjs
dv.taskList(dv.page("{{date:gggg-[W]ww}}").file.tasks
  .where(t => !t.completed)
```

But I’m not sure how you could ensure that the date it formats that way is the actual date of your daily note. It could work just nicely, but I haven’t used that template engine. I’m mostly using Templater, and it would look a little different in there.

Thanks

I adjusted a little to

dataviewjs
dv.taskList(dv.pages("{{date:gggg-[W]ww}}").file.tasks
  .where(t => !t.completed))

But am getting this error

Error:
– PARSING FAILED --------------------------------------------------

1 | {{date:gggg-[W]ww}}
| ^

Expected one of the following:

‘!’, ‘(’, ‘-’, ‘csv(’, ‘outgoing(’, file link, string, tag (‘#hello/stuff’)

You haven’t answered how you are calling this script. Is it after an ordinary template insertion into a note? Is it using Quick Add? Something entirely different?

The reason I’m asking is that I’m a bit confused as to the usage of the curly braces and the dateformat, and need to know which code is going to do something with it.

Sorry, the script lives in the daily note template - and the daily note template is automatically called when a daily note is created using the plugin Periodic Notes.

I may just have to think of a different way to do tasks in general that is a bit simpler.

I appreciate your help.

I’m a little sorry too, because that is a combination of plugins I’ve not used. And I’m using mostly Templater for most of my template manipulation. I’m not saying it can’t be done using the core template plugin, but I’m not the one going to give you the best advice on how to proceed with that plugin.

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