Use Dataview to list tasks under a specific header

Hello!
I wonder if it’s possible to list all tasks under a specific header using Dataview. I know how to do it using Query.
For example, I want to list all tasks under the header “# Doing” and stop it before it reaches “# Done”.

# Next

  • [ ] I’ll do it next

# Doing

  • [ ] I’m doing this

# Done

  • [x] Done task

The query would return me only: - [ ] I’m doing this

1 Like

Just food for thought…

The trick is going to be the “Doing” section, as there would have to be some key for that designation. You will need a secondary checkbox type of system via a button for example that would move the task from “Not Done” to “Doing”. The “Done” is by comparison rather easy.

1 Like

Hello,

There are several options:

  1. Create a note and place your Headers, and place specific dataview request under each. It will allow to expand headers
  2. Use dataviewjs

For example

      
const findDated = (task)=>{
task.due_date="";
task.completed_date="";
const found_due = task.text.match(/📅.?([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))/);
const found_completion = task.text.match(/✅.?([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))/);
if(found_due) task.due_date = moment(found_due[1]);
if(found_completion) task.completed_date = moment(found_completion[1]);
return true;
}


const NextTasks = dv.pages("#project/active and #area/home and #next").file.tasks.where(t => findDated(t));


const OverdueNextTasks = NextTasks.filter(t=> moment(t.due_date).isBefore(moment(),"day")).filter(t=>!t.completed).sort(t => t.path, 'asc');

const TodayTasks = NextTasks.filter(t=> moment(t.due_date).isSame(moment(),"day")).filter(t=>!t.completed).sort(t => t.path, 'asc');

const Next2weeksTasks = NextTasks.filter(t=> moment(t.due_date).diff(moment(),"day")<14).filter(t=> moment(t.due_date).diff(moment(),"day")>=0).filter(t=>!t.completed).sort(t => t.path, 'asc');

const Coffee = '<center><img width="150px" src="file:///Users/viktoriyazaripova/Dropbox/_ZBrains/ZTypeableDTT/_Service/_Attachements/coffee.png"></center>';
  

dv.header(3,"Overdue Tasks");
if(OverdueNextTasks.length===0)
{
 dv.paragraph(Coffee);
}
else
{
dv.taskList(OverdueNextTasks);
}

dv.header(3,"Today Tasks");
if(TodayTasks.length===0)
{
 dv.paragraph(Coffee);
}
else
{
dv.taskList(TodayTasks);
}

dv.header(3,"Next 2 week Tasks");
if(Next2weeksTasks.length===0)
{
 dv.paragraph(Coffee);
}
else
{
dv.taskList(Next2weeksTasks);
}
  

gives me the following:

or the following if all is implemented for today

3 Likes

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