Dataviewjs : tasks inside /under a list are not shown

Things I have tried

I tried to find the solution on internet, the forum and the documentation but i found nothing about this bug or my error.

What I’m trying to do

I have tasks in my Daily Jounral and some are inside/under list :

  • [X] Do the point 1 #todo by [[Boby Jean]]
  • [ ] Do the point 2 #todo by [[James Paul]]]
  • Others tasks to do : <— LIST
    • [X] Do the point 3 #todo by [[Boby Jean]] <— TASK UNDER A LIST
    • [X] Do the point 4 #todo by [[Boby Jean]] <— TASK UNDER A LIST

I created a dedicated page for “Boby Jean” in order to show all his task

I tried both with Dataview et Dataviewjs but I have the same result : “Do the point 3” is never show

task
where contains(text, "Boby Jean")
dv.taskList(dv.pages("").file.tasks
.where(t => t.text.includes("Boby Jean")))

BUT if i only list Task without any others arg “TASK UNDER A LIST” is shown :

task
dv.taskList(dv.pages("").file.tasks)

Hi.
Task queries work on task-level. Inside task-level you have the sub-level for sub-tasks, and so on…
Your task under a list is a subtasks (the parent list work like a parent-task).
To consider subtasks you need to use this query:

task
where contains(text, "Boby Jean") OR contains(subtasks.text, "Boby Jean")
1 Like

Dear @mnvwvnm,

Thanks you for your solution. I understand the problem now.
I read a lot of feedback you did and lot of your solution inspieded me.

Based on one of your post, I try to put my report on a table :
Your post : Create dataview table of multiple tasks within notes - #2 by mnvwvnm

I Adapted my report like this :

  • [X] Do the point 1 [by::[[Boby Jean]]]
  • [ ] Do the point 2 [by::[[James Paul]]]

And my report like this :

TABLE WITHOUT ID regexreplace(Tasks.text, "\[.*$", "") AS Task, choice(Tasks.completed, "🟢", "🔴") AS Status, regexreplace(Tasks.subtasks.text, "\[.*$", "") AS Subtasks, choice(Tasks.subtasks.completed, "🟢", "🔴") AS "Subtasks status", Tasks.by AS "By", file.link AS "File"
FROM "Journal" WHERE contains(file.tasks.by, [[Boby Jean]]) FLATTEN file.tasks AS Tasks

But the request give me Boby AND James.

If you could give me a “last help”.

I don’t know if I understand well your goal. But I think the issue is in:

  • generally, if you write WHERE contains(file.tasks.by, [[Boby Jean]]) your are asking this: "only the PAGES where the field “by” - in tasks level - contains “[[Boby Jean]]”;
  • if you ask for Pages, you get pages, i.e.,(your note contains “[[Boby Jean]]” but also others elements in the array “tasks”;
  • because this you get also the task with “[[James Paull]]”.

To filter tasks accordingly your goal, you need to apply the filter AFTER the FLATTEN command (because with flatten you get one task per row and not an array. (attention, after the FLATTEN file.tasks AS Tasks you need to use “Tasks” as the new name to “file.tasks”).

Try this:

TABLE WITHOUT ID
	regexreplace(Tasks.text, "\[.*$", "") AS Task,
	choice(Tasks.completed, "🟢", "🔴") AS Status,
	regexreplace(Tasks.subtasks.text, "\[.*$", "") AS Subtasks,
	choice(Tasks.subtasks.completed, "🟢", "🔴") AS "Subtasks status",
	Tasks.by AS "By", file.link AS "File"
FROM "Journal"
FLATTEN file.tasks AS Tasks
WHERE contains(Tasks.by, [[Boby Jean]])
1 Like

Dear @mnvwvnm,

Your well understand my need and the solution work find.

Thx for the explanation, I will be more vigilant to the function output.

Thanks you again :handshake:

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