What I’m trying to do
I’m trying to create a very simple habit tracker based on a habits note which is updated by daily notes. I want each daily note to have checkboxes for each habit, and when I click these checkboxes, the habit tracker should update. I know there are habit tracker plugins available, but I want to keep it simple and I like the format I have set up now (or at least I will when it starts working!).
Things I have tried
I’ve come up with the following code which has a problem described below.
My dataview code is as follows:
TABLE WITHOUT ID
file.link AS Date,
choice(contains(list.text, "[x] Sleep"), "🟩", "🟥") AS "🛌",
choice(any(contains(list.text, "[x] Exercise")), "🟩", "🟥") as "🏃",
choice(contains(list.text, "[x] Reading"), "🟩", "🟥") as "📚",
choice(any(contains(list.text, "[x] Meditation")), "🟩", "🟥") as "🧘",
choice(any(contains(list.text, "[x] Writing")), "🟩", "🟥") as "✍️"
FROM #dailies
WHERE file.day <= date(now) AND file.day >= date(now) - dur(7days)
SORT file.day ASC
And I have a template so that each daily note has the following format where the top header is in YAML:
Properties
tags: #dailies
date: {{date}}
{{date}}
Habits
- Sleep
- Exercise
- Reading
- Meditation
- Writing
PROBLEM
When I create a daily note, this shows up in my dataview table but when I check the boxes, my dataview table does not update. All of the boxes stay red. Can someone please provide me with the correct dataview code? I’d really like to make this work. (And take it easy on me I’m clearly a beginner ). (Ps I’ve done a bit of research and I really cannot for the life of me figure out how to use contains/anything with dataview in this way).