Dataview - getting value from inline-key through dvjs

Intro
I’ve got my Daily Notes set up with an inline key “Month” which auto-populates through Templater to [[2024-02]] (for february 2024).

I’ve also got some sort of habit tracker setup with toggles, which generates a boolean in the Properties. For example “habit_core_workout: true”

I’m looking for a way to get the total number of times the habit is “true” in a certain month in that month’s review


Setup
Daily Reviews in “Reviews/00 Days” with file-name as YYYY-MM-DD
Monthly Reviews in "Reviews/02 Months with file-name as YYYY-MM
In Daily Reviews an Inline key “Month:: [[YYYY-MM]]”


What I’ve tried so far

  • I’ve succeeded in getting the current file-name (and link) through
    $= dv.current().file.link (and $= dv.current().file.name)
  • I’ve succeeded in getting the number of files in “Reviews/00 Days” through
    $= dv.pages('"Reviews/00 Days"').length
  • I’ve succeed in getting the number of true habits in the folder “Reviews/00 Days” through $= dv.pages('"Reviews/00 Days"').where(p => p.habit_core_workout == true).length

Somehow I can’t get the total number of days in this month, let alone the number of days in this mont the habit is ‘true’. I’ve tried $= dv.pages('"Reviews/00 Days"').where(p => p.Month == dv.current().file.link).length with no results.


Verification done
To check if the type of value I’m looking for is the same, I’ve also tried $= dv.current().file.link == dv.current().Month and $= dv.current().file.name == dv.current().Month but that both results to ‘false’


Question
Can anyone help me get the following to work:
$= dv.pages('"Reviews/00 Days"').where(p => p.Month == dv.current().file.link && p.habit_core_workout == true).length

Could you show how this looks in your final notes? Is it Month: [[2024-02]] or Month: "[[2024-02]]" ? One of these is an array, and one is a link… This has a lot of impact on your queries later on.

If it’s correctly formatted, you might also want to take a look on this post:

Comparing links needs to use aLink.equals(anotherLink) :slight_smile: