Looked through the forums but can’t seem to find a working solution. I am able to successfully do an inline query that counts number of notes where a certain tag appears, but am not able to count notes for specific YAML parameters.
What I’m trying to do
Apologies as I’m new to Dataview and have little to no coding knowledge. After using Obsidian simply (just making notes on my projects) for months I’ve amassed a lot and would like to be able to count notes based on YAML frontmatter specified.
Sample frontmatter:
tag: Project
ProjectName: Spiderman
Value: Mind
I would like the dataview query to return the total number of notes whose ProjectName = “Spiderman”.
When I type $= dv.pages("#Spiderman").length it returns to me the total number of notes with “tag: Spiderman” (which do not exist since Spiderman is under the parameter ProjectName and not tag)
Help would be greatly appreciated as my workflow revolves around knowing how many notes there are per YAML parameter.
Thank you in advance.
If I understand your request correctly, you’re asking for an inline DataView query that counts how many pages have a YAML field of ProjectName with the value “Spiderman”. I recommend a query like the following:
Thank you so much! I couldnt figure out the syntax to specify a YAML parameter and you showed it here as .where(page =>page. =="").length. Thanks again! This will be very helpful for my workflow.