```dataview
task
```
This will display all tasks completed and not.
How do I only display not completed tasks?
```dataview
task
```
This will display all tasks completed and not.
How do I only display not completed tasks?
You can ask to plugin developer in GitHub page (GitHub - blacksmithgu/obsidian-dataview: A complex query language implementation for the Obsidian note-taking tool.).
Since the version 0.3.6 the developer introduced the feature āTask lists now include task context (non-task parents/children)ā. But none extra information in plugin documentation (https://blacksmithgu.github.io/obsidian-dataview/docs/intro).
EDIT: Thereās some information in the JavaScript API documentation, but I donāt have knowledge in JS query language.
I could only find a reference to a āgroupByFileā option, which will render the filename containing the task. Iād love to get the header above the task (which is the column name if you use the Kanban plugin).
As I said before, JS is not my ground!
I see another limitation: children tasks are not filtered.
Considering my limitations in the plugin, I suggest two ways:
```dataviewjs
dv.taskList(dv.pages().file.tasks
.where(t => !t.completed))
cssclass
in frontmatter:---
cssclass: hidetasks
---
```dataview
task
/* hide checked tasks */
.markdown-preview-view.hidetasks ul > li.task-list-item.is-checked {
display: none;
}
This affects all the content of the note with the cssclass defined, that is, all the checked tasks on this note are hidden.
Hey thanks, your first solution:
```dataviewjs
dv.taskList(dv.pages().file.tasks
.where(t => !t.completed))
```
works perfectly.
I do have a follow up question.
I have a file called āJournal Template.mdā with checkboxes that I do not want to appear. Iāve tried this code:
```dataviewjs
dv.taskList(dv.pages().file.tasks .where(t => !t.completed)) &&
dv.page(!"Journal Template.md")
```
as well as others and it does not work; the check boxes from the āJournal Template.mdā keep appearing.
What am I doing wrong?
As I mentioned before, my knowledge in dataview javascript language is almost zero!
Said that, by the logic I think you need to write the āsource conditionsā in the first dv.pages()
. Try this:
```dataviewjs
dv.taskList(dv.pages("![[Journal Template]]").file.tasks
.where(t => !t.completed))
(I didnāt test thisā¦)
Well, I appreciate the effort, but that refuses to work.
Sorry, this is beyond my limited knowledge.
I can only suggest this: if your file āJournal Templateā is inside one folder that you donāt want to include in your search (e.g. folder āTemplatesā), then you can exclude that folder (and all files inside that folder).
```dataviewjs
dv.taskList(dv.pages('!"Templates"').file.tasks
.where(t => !t.completed))
('"Templates"')
the search is limited to folder Templates
;('!"Templates"')
or ('-"Templates"')
the search excludes that folder.Or, returning to the way to exclude a specific file:
```dataviewjs
dv.taskList(dv.pages().file.where(f => f.name != "Journal Template").tasks
.where(t => !t.completed))
Thank you, the second one worked. Very helpful.
Iāve found it helpful at times to move the pages() parameter into the where clause, like this:
```dataviewjs
dv.taskList(dv.pages()
.file.where(f => !f.path.includes ("foldernamehere")
.tasks.where(t => !t.completed))
```
Basically it gets all the files for all pages, then filters out anything that doesnāt include āfildernamehereā in the full path of the file, then filters out completed tasks.
You can also perform other operations on the file component, like āf.nameā
Thanks for the descriptive explanation. I really appreciate that.
Iām a newbie in all this stuff (code languages, etc.) trying to capture some information for my own use of Obsidian.
The Dataview plugin has a tremendous potential. But for ānon-codersā the approach is no easy.
For now the generic approach (dataview) is less complex and more or less accessible through the plugin documentation. But the approach via javascript (dataviewjs) is much more complex and the plugin documentation is very uncompleted for ācode-newbiesā. Much complex but certainly more rich in potential.
In my personal use I donāt use (yet) this approach because all these limitations. I want to but the learning curve is in another level. This help call was a pretext to start this (long) learning.
Thanks.
EDIT: Just one question: when you write āfoldernamehereā works too with āfilenamehereā?
You might consider using the Tasks plugin - much easier to use for filtering tasks various ways.
Thanks for posting this! I didnāt know you could filter at the task level inside a dv.taskList(). Super helpful!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.