Dataviewer - Table Headers From Tasks Under A Header

Hi all,

I feel a bit silly for not being able to figure this out on my own but I’ve been trying to figure this out for a bit over an hour now and can’t quite get it!

I have a daily note with daily tasks that I would like to summarise in a table. My daily tasks are found in the following directory To-Do/Daily To-Dos/, the daily tasks section is as below. The daily note is named in the yyyy-mm-dd format.

# 📅 Daily Tasks

- [ ] Journal 
- [ ] Brush teeth
- [ ] 5,000 steps (check Paseo)

I would like to make a dataview table in a separate note that has a header for each of these tasks and for the file name but I can’t figure out how! I’ve read through the docs on dataview fields and implicit fields but I can’t find a clean way (without inserting maybe a tag or something to each task) to do this.

Can anyone offer some advice? Hopefully this will be helpful to others too as I can’t be the only one struggling with this!

I don’t quite get what you mean here. “A header for each of these task”? Are the tasks identical in all the files, and do you want to group them by task? And if so, then what do you mean with “and for the file name”?

Are you simply wanting to extract this section from each daily note, and show all of them on this particular page? Or do you want to sum them up somehow, like a habit tracker?

And finally, do you have any other tasks on your daily notes, or are these three tasks always the only tasks on any given daily notes? (If not, you’ll need to tag these somehow (or do some magic related to them being under a given header, or similar).

So please provide more information, we’re not mind readers, even though many posters seem to believe so.

I’m sorry that I wasn’t clear enough, allow me to elaborate. I’d like to make a table that looks like the below (albeit in a dataview table and not a more standard markdown table). Summed up like a habit tracker, as you mentioned.

| Filename   | Journal Task | Brushed Teeth Task | 5000 Steps Task  |
| 2023-01-16 | Complete     | Complete           | Null (or failed) |
|            |              |                    |                  |
|            |              |                    |                  |

This table should pull data from the daily notes located in the To-Do/Daily To-Dos/ directory, specifically this section below.

# 📅 Daily Tasks

- [ ] Journal 
- [ ] Brush teeth
- [ ] 5,000 steps (check Paseo)

There are other tasks in my daily notes, so yeah I’m looking for that mentioned “magic,” that they’re under a certain header. Or tagging them in a way that’s not distracting when just viewing them.

Does this clear up what I’m asking? Would anyone know how I could do this?

Yes, and yes. Much better!

Would the following suffice in some variant for you?

  journal.status as "Journal", 
  teeth.status as "Teeth", 
  steps.status as "Steps",
  tJournal, tTeeth, tSteps
FROM "To-Do/Daily To-Dos"
FLATTEN filter(file.tasks, (t) => t.text = "Journal") as journal
FLATTEN filter(file.tasks, (t) => t.text = "Brush teeth") as teeth
FLATTEN filter(file.tasks, (t) => t.text = "5,000 steps (check Paseo)") as steps
FLATTEN choice(journal.status = "x", "Written", " ") as tJournal
FLATTEN choice(teeth.status = "x", "Brushed", " ") as tTeeth
FLATTEN choice(steps.status = "x", "Walked", "Null (or failed)") as tSteps


Adapt and change column titles, text to whatever you feel like! :smiley:

In my test setup this returned:

Disclaimer: This solution is very dependent on you not changing the text in any ways, as that would break the logic. It would be safer using tags, or other mechanism for marking the tasks. Text matching is volatile by nature.