Filtering based on a parent note's metadata (dataview)

What I’m trying to do

Hi all,
I have recently just setup my new task system in Obsidian with the following structure:

  • Individual file per task
  • Individual file per project
  • Task files “link” to their respective project like so: project:: [[Clean up the garage]]
  • Both projects and tasks have statuses. e.g. a project can have the status #ps/current where as the task #as/now

I’d like to create a list of #as/now tasks where their linked project has a status of #ps/current. Is this possible with dql? Or am I needing something a bit more advanced with dataviewjs?

Things I have tried

Honestly, I haven’t gotten too far on my own. I started to put together a WHERE clause, but soon realized that I didn’t have “access” to the project’s status from a task level.

Any help would be greatly appreciated!

Would be easier if “status” was a field and not a “tag”. For this purpose tags are more difficult to work with, because they are, by default, an array and you can have multiple tags in same file.

But possible. Try this

LIST
FROM #as/now
WHERE contains(project.file.etags, "#ps/current")
1 Like

I’ll give it a go thanks!

FWIW my statuses are also a field. So I have the then setup like this: action-status:: #as/now. How would you go about it differently with a field - maybe it works

I think the previous query works with your tags.
When I said "Would be easier if “status” was a field and not a “tag”, in the case I was talking about the status in the project file, not in task note. (because you need to target the status of the project via the link in the field project:: in task file). But works with project.file.etags.
For example, if you create in project the field status:: done you can target this status through the link in the field project in tasks >>> project.status.

wow worked like an absolute charm! Thank you so much

Thanks for the explanation. I actually do have that field too. So in the project files I have project-status:: #ps/current.

I gave your 2nd suggestion a try and it also worked without a hitch:

WHERE contains(project.project-status, "#ps/current")
1 Like

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