obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

Allow displaying of the note link with a TASKS query

Open dredhorse opened this issue 1 year ago • 5 comments

Is your feature request related to a problem? Please describe. I created a note with a dataview pulling in all the tasks. But if I use TASKS to do that I only see the tasks, not other information (most importantly from which note the task is. I can use a TABLE query like described here https://forum.obsidian.md/t/create-dataview-table-of-multiple-tasks-within-notes/31054 but then I can't check the tasks.

I use this query to make sure that I don't miss any task hiding somewhere in my notes and to be able to close any task which I already did complete.

Describe the solution you'd like A way to allow display of the note containing the task in TASKS

Describe alternatives you've considered A way to be able to complete tasks in TABLE

dredhorse avatar Jul 22 '22 13:07 dredhorse

This can be done with a bit of DVJS. The dv.taskList method should help.

AB1908 avatar Jul 22 '22 13:07 AB1908

will look into it in the future, do you have perhaps a code snippet handy? 😀

BUT.. I know why I came up with the request.

some code:

TASK
FROM !"300 Planner" and !"900 Support" and !#type/boards/kanban
WHERE !completed

different views In one vault:

  • [ ] task one
  • [ ] task two

in an other vault:

[[Note1]]

  • [ ] task one

[[Note2]]

  • [ ] task two

any idea? i guess I found it... the later one is dataview 0.4.26 and the first one 0.5.41, so either WAD for design change or a bug.

Plus in the updated version (just did that) I also have the issue that it shows the next line after a task if the task finishes with a note link.

dredhorse avatar Jul 22 '22 14:07 dredhorse

It sounds like GROUP BY file.link or GROUP BY section at the end of your query would be enough.

NomarCub avatar Jul 22 '22 18:07 NomarCub

you are correct.. is this somewhere in the change notes? because in the old version the TASKS command was doing it by default. The new approach is better perhaps as more flexible 😀

Example with both codes

TABLE WITHOUT ID
regexreplace(Tasks.text, "\[.*$", "") AS Task, Tasks.due AS "Due Date", file.link AS "File" 
FROM !"300 Planner" and !"900 Support" and !#type/boards/kanban
WHERE file.tasks
FLATTEN file.tasks AS Tasks
WHERE !Tasks.completed
TASK
FROM !"300 Planner" and !"900 Support" and !#type/boards/kanban
WHERE !completed
GROUP BY file.link

now I just wonder how code would look like for the table which would allow completing the task.

dredhorse avatar Jul 23 '22 09:07 dredhorse

We can't really use checkboxes from a table to do that since the "checking" doesn't change the actual note. It might work through clever DVJS trickery but I haven't figured out how or if it's doable at all.

AB1908 avatar Jul 23 '22 12:07 AB1908