Dataview task filter with new NON_TASK capabilities

Hello Everyone

I am currently looking to filter tasks from all notes in a specific folder, based on a particular metadata, using the dataview. Previously, I had been able to achieve this by utilizing the following query successfully:

TASK
WHERE customer = "MyCustomer"
WHERE projectName = "MyProject"
WHERE !completed
GROUP BY workstream
SORT workstream

Since the major recent update to the task feature, I would also like to exclude “NON_TASK” from my results. Unfortunately, my attempts to update the query have been unsuccessful so far.

I what I am trying to achieve is feasible and, if so, how should I proceed ?
Thank you in advance.

Moved from Share & Showcase to Help.

And exactly what is “NON_TASK”? Is that literal text, a tag, or something entirely else?

This is the builtin status type has been added:
Status Types | Obsidian Tasks (obsidian-tasks-group.github.io)

That is a Tasks specific extension, readily available within Tasks code blocks, and not to so available within dataview queries.

However, it’s grouping various task statuses, and queries can be made against them within dataview queries as well.

```dataview
TASK
WHERE customer = "MyCustomer"
WHERE projectName = "MyProject"
WHERE !completed
WHERE !contains(list("a", "b", "c"), status)
GROUP BY workstream
SORT workstream
```

Here you would need to replace the list of status characters with all of your non task status characters.

You could optionally flip the condition, aka remove the exclamation mark, and list all the wanted characters.

2 Likes

Blockquote
Here you would need to replace the list of status characters with all of your non task status characters.

Due to the increased number of available statuses in the latest task update, I would rather work with status types (such as TODO, DONE, IN_PROGRESS, CANCELLED, and NON_TASK) instead of individual statuses.

This approach would save me from having to deal with complex query updates if I were to make changes to the task status mapping in the future, considering that the query will be deployed across numerous pages.

Regarding the methodology to build the query, I have no concerns about utilizing either the built-in capabilities or the dataview.

So going back to my initial question, I tried to add my initial query a WHERE !NON_TASK but it has no effect. Still wondering what is the best way to achieve this.

So in other words: What is the best way, to query tasks from all notes in a specific folder, based on a particular metadata, and filtering on status type.

You can’t do that within a dataview query, only within a Tasks query. Tasks and dataview are two different plugins with their own functions and variables.

If you want to filter on the status type directly, you need to do a Tasks query, not a dataview query.

there is work on SQL queries being done. Not sure when this might get added officially, but it will allow you to do what you want and much more. It specifically supports using status name or check mark in a where clause.

What do you mean @triedmanyapps ? SQL? Are you referring to Dataview or Tasks? Or maybe even Datacore, which is yet another beast (not currently active, but it’ll change stuff related to tasks)?

Or are you talking about something related to core Obsidian?

The statement above is inaccurate. The dataview query in the original post is functional. The only issue was attempting to add a filter for status type to the existing query, which was not successful.

Sorry for asking again but this is still unclear for me how can I query tasks from all notes in a specific folder, based on a particular metadata, and filtering on status type.

Holroy’s statement is accurate. You are correct that you can query tasks in Dataview, but the “NON_TASK” status type is a feature specific to the Obsidian Tasks plug-in (note that the link you included above demonstrating the new “Status Type” is a link to Obsidian Tasks).

As mentioned by Holroy, while you cannot use the NON_TASK feature in Dataview, you can use the character from the custom statuses to build the same function into a query. For example, if you have a non-task bookmark task defined as “- [b]”, then you could filter out statuses containing “b” as Holroy described.

1 Like

very clear. Thanks you.
So I`ll proceed as Holroy proposed untill we can have a better option.

1 Like

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