Dataviewjs table of tasks by tag

Things I have tried

I’ve looked in the obsidian forums and on reddit, I’ve tried different alternatives using dataview from the forum and reddit. I read the docs on dataviewjs and dataview. In an abundance of confusion, I’ve just vomited a bunch of the things I’ve tried. Please help!

The closest I’ve gotten to what I want was based on the forum link below and code shown below for dataview. I’ve also messed around with dv.taskList but can’t figure out how to get it into table format. I tried to find information on the groupByFile to see if changing that would work (no luck). I also tried using the dv.pages that works in dv.taskList (dv.pages().file.tasks.where(t => t.text.includes(“#p-Polio”))) in dv.table, but it either errored out or gave me a blank table.

Table set up, but the formatting is weird and I can’t check the check boxes

rows.Tasks.text as Tasks,
choice(rows.Tasks.completed, "✔", "❌") AS "Task Completed",
rows.Tasks.subtasks.text AS Subtasks, 
choice(rows.Tasks.subtasks.completed, "✔", "❌") AS "Subtasks status",
rows.Tasks.fullyCompleted as "Fully Completed"
FROM "" 
FLATTEN file.tasks as Tasks 
WHERE contains(Tasks.text, "#p-Polio")
SORT rows.Tasks.completed

Can’t figure out how to make this into a table format with multiple columns

dv.taskList(dv.pages().file.tasks.where(t => t.text.includes("#p-Polio")))

dv.table error Cannot read properties of undefined (reading ‘link’)

dv.table(["File", "Tasks"], 
dv.pages().file.tasks .where(t => t.text.includes("#p-Polio"))
	.map(b => [, b.tasks]))

dv.table blank error (as soon as I try to add any kind of header and mapping it throws the link error)

dv.table(dv.pages().file.tasks.where(t => t.text.includes(“#p-Polio”)))

What I’m trying to do

Hi all, I’m grateful in advance for the help on this, since a lot of people have been asking about it and a lot of ALMOST solutions are out there. What I want is very similar to what this person posted, but with a few differences, listed below.

Basically, what I would like to do is create a table of all tasks that could be scattered across my note with a particular hashtag (for example, all tasks associated with a project on polio have “#p-Polio” at the end). In the table, I want…

  • To be able to see/check the checkboxes (which I think I can only do with dataviewjs?)
  • Add columns with any associated sub task (I don’t need a check box for the subtask, but if I could have one, that would be awesome!!)
  • Add columns for the status of any associated subtask (if I can’t have the subtask)
  • Be able to filter and/or sort by status, due date, etc.
  • Bonus would be if I could have clearly delineated lines (borders) between each task and the next one

Main point:

  • tasks queries are a particular case in dataview because they’re the only case that allows the query “to write” in the original file, i.e., when you check/uncheck the box it takes effect in the source
  • generic dataview results are a dynamic thing (a render created when you run the code), they don’t exist as “real” content
  • target tasks outside the tasks queries is possible, but don’t expect the ability to interact with the original, i.e., you can’t check/uncheck the original task (only in a fake/temporary way)

So, you can’t do this (in dql or dvjs).

It isn’t an impossible thing - there’re some “tricky” ways to do that (running “false queries” inside table queries) - but your case seems to be very complex to do that.

1 Like

Well now I feel better that I couldn’t figure out how to do it! Time to start thinking about if I should reorganize how I’m flagging and finding tasks!

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