I am new to Obsidian and try to build a habbit tracker, following along Sergio’s YT tutorial
What I’m trying to do
This works fine, but I also want to have “grouped” habit statistics.
For example, in the case I walk the dog, or run, or cycle, I get an attribute physicalActive: true
.
Things I have tried
Templater: Habit Tracking Templater Functions
<%*
function activeBoolNumber(...params) {
return params.some(param => Boolean(param));
}
%>
Daily Note: 02 - BuJo/2025/January/2025-01-14
---
tags:
- habbit-tracking
aliases:
habits:
dogwalk: 1
hike: 0
stretching: false
physical_active: <% tp.user.habitGroupsBoolMerge(tp.frontmatter.habits.dogwalk, tp.frontmatter.habits.hike, tp.frontmatter.habits.run, tp.frontmatter.habits.cycle, tp.frontmatter.habits.workout) %>
run: 0
cycle: 0
workout: false
sport: <%* activeBoolNumber(habits.run, habits.cycle, habits.workout) %>
---
...
Habit Tracker:
In the file somewhere (can’t post the full files, as the code blocks would be nested):
Working
This renders the Tracker view with the streak
datasetName: Dog Walk
searchType: frontmatter
searchTarget: habits.dogwalk
folder: 02 - BuJo/2025/January
month:
startWeekOn: 'Mon'
color: steelblue
Not working
This gives the following error: No valid Y value found in notes
datasetName: Physical Active
searchType: frontmatter
searchTarget: habits.physical_active
folder: 02 - BuJo/2025/January
month:
startWeekOn: 'Mon'
color: steelblue
I got the Templater user function working, but to my understanding I can only use it either on creation of a new daily note, or have to run in manually and replace it with actual values. Once replaced, changes on the input will not reflect change in the output anymore, of course.
Actually, I came to the conclusion this was the wrong approach.
Is there any other way to calculate a second value based on others to be desplayed by a graph / table?
Are queries the way to go for Tracker?