Hi folks. Another Obsidian newbie, navigating the vast promise of dataview queries and failing…
So, I’m trying to create a dataview table which can query all of headings in a single file and then make a table from content within each heading.
Its a coffee ratio experiment (sad, I know!). My goal is to mess around every day with different grinds, temperatures, durations, ratings etc and ultimately get this into a nicely formatted summary table view
So, I have created a series of list items under each heading with the following format (eg: Blend:: Grind:: Water_Temp::, etc). I pull this in via a basic template (where the heading becomes the date, as in Date:: Wednesday, July 13, 2022 for example) and I wanted dataview to put these resulting headings into a table view so I could review each of the list items per heading.
Is this possible?
The file is imaginatively called “Aeropress Experiments”
Here is what I have, knowing it will only pull results from the page itself and not segment line by line on a per heading basis…
TABLE Blend AS “Blend”, Coffee AS “Coffee”, Grind AS “Grind”, Water_Temp AS “Temp”, Extraction_Time AS “Duration”, Method AS “Method”, Rating AS “Rating”
FROM “Aeropress Experiments” but this does not create one line per result of “Date::” just one file called “Aeropress Experiments” with the content
I realise I am probably approaching this incorrectly. I didn’t want to create a new file for every day and pull from all of these files. I was hoping to contain it in just a single page/file?
dataviewjs is probably more suited to this maybe. But… well… no idea of JS or the syntax!
Hi and welcome @weareborg!
Dataview does not have a notion of “heading”, since it pulls the Field:: value pairs out of the file and caches them separately. The built-in Obsidian Search does have a notion of heading, so with an embedded query block you could list your sections. But that does not get you the table format.
So unfortunately the headings do not help dataview correlate the different fields by experiment. What if you had an extra “Date:: …” line in your file somewhere, or you forgot to include the Method one day… the order of fields in the file is not enough. You already realized that intuitively when trying to organize by heading - unfortunately that one does not work. dataview is designed to do this by filename (what if you made “Aeropress Experiments” a folder?) but if you cannot do that then what you want is some kind of nested object to contain each day’s experiment. You can get a nested “inline” dataview object with some creative formatting, but not if you want linebreaks and list items for your fields (which are very reasonable things to want, for fields you will be filling out over and over!)…
Tiny improvement: You can use TABLE WITHOUT ID to get rid of the filename, and add a column Date AS "Date" to get the non-segmented version. Each column will have a list, and the rows will kind of line up, maybe.
Suggestions towards answering your question: reconsider multiple files (perhaps inside a folder so you can easily hide them from view?), or try asking about nested objects on the dataview GitHub page’s Discussions tab.
Good luck! Let us know what you come up with. (And your discoveries on optimal coffee-making!)
Thanks a mill @scholarInTraining !
Appreciate this detailed response, confirming my worst fears. A folder and files!
Actually your simple suggestion of TABLE WITHOUT ID and Date AS “Date” (d’uh) work very well! I know its not the exact solution and is dependent on me filling out each field properly in order to keep the table vertically aligned but if I am experimenting I need to be consistent with my data anyway.
Thus far, my Aeropress Experiments are a mixed bag.
For now, 48 clicks on the 1Zpresso with 200g of 93 degree water, using the Aeropress Inverted method, with a 2 minute extraction time and a 30 second plunge, yield… a very average cup of coffee…
The quest for the ultimate cup of coffee will continue well into the next millennium.