Does anyone know how I to craft a query to retrieve all uncompleted tasks that contain a link to the current file in the text of the task OR any tasks contained within a sub-list item containing the same link.
Here’s an example of what my notes usually contain:
In the example above I’m trying to create a DV query inside “My Test File.md” that returns all the tasks above. Ideally it would only including list items that contain a task e.g. “one last task” and not “some more text with no task” but I’d grateful just to get this working
task where file.path = this.file.path and !completed
but that didn’t work.
you can start with this:
WHERE contains(text, this.file.name) AND !completed
but your first example (a list with nested tasks) isn’t listed in the results.
This works great, except for the nested tasks as you mentioned - any way to return those as well?
WOW, thank you @justdoitcc!! This is probably one of the most comprehensive and helpful answers I have come across (thank you for taking the time!!)
Most of what you’re doing is above my head so I may be missing a lot but I can’t seem to get this to return any results.
I tried making the two edits you mentioned:
- Changing the the FROM to “” or even a subfolder
- Removing the “!” from
WHERE file.name = this.file.name
Are there any other changes I should be making? I also downloaded the example files and query which work great so my guess is that it has something to do with the 2nd change?
Lastly, i’ve noticed that Obsidian slows down quite noticeably when I add this query e.g. it locks up for a several seconds, especially when using
FROM "" (my vault has ~400 files in it). Did you experience any performance issues?
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.