Allow me to get a little philosophical, and ask the question what is the proper use of properties and a journal note? From my point of view I think the properties should be just that, properties of the current note. And I believe that the payload, aka exercises, should be kept within the main note. After all, we’re talking about your daily journals, and you exercising is a part of that.
With that in mind, I’d like to suggest a different approach to storing these data , and showcasing them in a slightly better manner (in my opinion). Imagine adding decorated tasks like the ones below into your daily journals:
- [t] (type:: squat), (weight:: 150), [sets:: 8, 7, 8]
- [t] (type:: deadlift), (weight:: 200), [sets:: 7, 7, 7]
Which with some custom CSS could look like:
Some details related to my markup
In my setup I use t
to denote “training”, but you could of course use whatever letter you’d like. I’ve also here used inline fields, and they can be grouped either by ( ... )
where the field name is not displayed, or [ ... ]
where the field name is displayed (as for the last field sets
). These can be styled however you’d like them to be, and you’re free to choose field names and so on, as you’d like.
This allow for a variety of queries:
## Tasks variant
### Pure task list
```dataview
TASK
FROM "ForumStuff/f73/f73581"
WHERE status = "t"
SORT type, file.day
```
### Simple table view
```dataview
TABLE WITHOUT ID
file.link as Day,
task.type as "Exercise", task.weight as "Weight", join(task.sets, ", ") as Sets
FROM "ForumStuff/f73/f73581"
FLATTEN file.tasks as task
WHERE task.status = "t"
SORT file.day, task.type
```
## All days, all exercises
```dataviewjs
const thisFile = dv.current().file.name
let max = 0
const result = dv.pages('"ForumStuff/f73/f73581"')
.file.tasks
.where(t => t.status == "t")
.map(e => {
const count = e.sets.length
if (count > max) max = count
return [e.type, e.weight, ...e.sets ]
})
let headers = ["exercise", "weight" ]
for (let setNumber = 1; setNumber <= max; setNumber++ ) {
headers.push("Set " + setNumber)
}
dv.table(headers, result)
```
Which display as:
Some advantage of this kind of setup:
- In a given day it clearly shows which exercises you did, due to use of icons and clear descriptive text
- It’s easily queried (with backlinks) as tasks, thusly allowing you a neatly compound object or a nested property so to speak
- It’s easy to pick out exercises of a given type, or a given time period, since all this information is readily available
- The syntax for adding sets is also easy, since we can just list the number of the various sets directly as pure text
- And it also allows for styling to your hearts content if you’re into that