Both of your issues are related to the FLATTEN file.tasks as task
in my original query, which splits out the tasks into their separate items. Aka make three rows for each attribute you want to track. To handle that we either need to start doing any(map(file.tasks, ...))
stuff, or do some other magic to regroup the result into a single line again by doing GROUP BY file.link
and some extra magic to collate the result.
A non-flattened version
To do this the “proper” way you need something like the following:
```dataview
TABLE runC as Run, meditateC as Meditate, waterC as Water
FROM "Daily notes"
FLATTEN file.tasks as task
WHERE any(map(list( "run", "to meditate", "drink water"),
(m) => contains(task.text, m) ))
FLATTEN choice(contains(task.text, "run"), "OK", "-") as runC
FLATTEN choice(contains(task.text, "to meditate"), "OK", "-") as meditateC
FLATTEN choice(contains(task.text, "drink water"), "OK", "-") as waterC
```
But it turns out that Dataview’s contains()
can do some stuff behind the scenes for us:
```dataview
TABLE WITHOUT ID file.link as "Daily note", runC as Run, meditateC as Meditate, waterC as Water
FROM "Daily notes"
WHERE any(map(list( "run", "to meditate", "drink water"),
(m) => contains(file.tasks.text, m) ))
FLATTEN choice(contains(file.tasks.text, "run"), "OK", "-") as runC
FLATTEN choice(contains(file.tasks.text, "to meditate"), "OK", "-") as runC
FLATTEN choice(contains(file.tasks.text, "drink water"), "OK", "-") as runC
```
On a related side note
Have you scanned the community plugins for alternative tracker
plugins? There exists a whole lot of them with different focus. Just for the fun of it I installed the Habit tracker 21 plugin, and created the files “Habits/run”, “Habits/to meditate” and “Habits/drink water”, and ran the default variation over it (and clicked on various days in the table) and it displayed this table for me:

That’s kind of nice variant I think, and it’s easy to see streaks and correct if you did or didn’t do a habit the previous day(s) or not. I’m actually considering whether I’ll start using this in my own vault! 