Dataview task help

What I’m trying to do

I’m looking to create a unified task list in the current day’s Daily Note that combines:

  • Any uncompleted tasks from past Daily Notes (folder name: “daily_notes”). Tasks in my Daily Notes are for quick things that I need to get done soon and/or are not at the level of putting in my full task-management system.
  • Any uncompleted tasks in my vault with a specific tag (#includedaily). I do this because I maintain a number of Kanbans for different projects and purposes and I want to “promote” a select few to my Daily Note for visibility and priority.

So far, I’ve accomplished this with two queries:

not done
path includes daily_notes
short mode
TASK
FROM ""
WHERE !completed
WHERE contains(text, "#includedaily")

Problems with this approach:

  • It seems like this should be doable with one query. As you can tell, I can’t seem to grasp the query syntax…just hacking away until I get something close
  • The first query duplicates any tasks in the current Daily Note

I’m really trying to learn how to do this correctly to better understand how dataview (and dataviewjs) work.

Thank you.

1 Like

You could add a line after your path includes line that has path does not include ... replacing the “…” with the title of that day’s note. (If you use a template to make your daily note, you can put however your template system refers to the file’s title in place of the “…” and your query will then be correct for each day!)

Important Note: your first query uses the Tasks plugin query system (inside a triple-backtick tasks block), no dataview involved at all, while your second query uses dataview. You’ll need to translate one of them if you want to combine them.

I think combining them in a tasks query block is not yet possible but it will be very soon with some upcoming new features in the Tasks plugin! Once those new features release, the Tasks documentation will hopefully show how to do this.

Right now, you can combine them in dataview. Try modifying the last line of your dataview query to be something like:
WHERE contains(text, "#includedaily") OR contains(path, "daily_notes")
But! This will have the “duplicates tasks in the current Daily Note” problem again. You could fix that with the following.
WHERE contains(text, #includedaily") OR (contains(path, "daily_notes") AND !contains(path, ...))
replacing the “…” with the title of the note as explained above. Note the extra parentheses!

1 Like