Help convert a Dataview table into inline DQL for counting notes

Hi everyone, very simple question.

What I’m trying to do

I want to have a single line in my journal that shows how many journal entries have a status of “open”.

Things I have tried

So I tried the following but it doesn’t work as intended.

$=dv.pages('#daily' AND p.Status == "open").length

Does this work?

`$= dv.pages("#daily").where(page => page.Status == "open").length`
1 Like

Yes, that worked! Thank you very much. I also realized that the template note was being included so I changed it to only include #daily notes in the _daily folder. Now I just need it to ignore today’s note. For now I’m just subtracting 1 since today’s note is “open” until the end of the day generally. Would be better to extend it to filter to notes before today.Also, the requirement is to use the property Date of the note and not the created time or modified time because I constantly create or modify past and future Daily notes.

$= dv.pages('#daily and "_daily"').where(page => page.Status == "open").length - 1

1 Like

I think this is ultimately what I’m after. Thank you Hampton for getting me in the right direction.

$= dv.pages('#daily and "_daily"').where(page => page.Status == "open" && page.Date.ts < dv.date('today').ts).length

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.