Hello everyone.
I have a general question which has huge impact on the way I will structure the relation between my notes in Obsidian: bottom-up or top-down.
What I want
I’m a carpenter and my goal is to sort my tools. For each storage box (e.g. Systainer01) I want to see which tools and accessories are in there, e.g.
# Systainer01
- Cordless Screwdriver
- Battery
- Standard Bits
- Dry Marker
- Ruler
Top down approach
In this case a tool note contains the relevant frontmatter, for example the Cordless Screwdriver note:
place: [[Systainer01]]
accessories:
- [[Battery]]
- [[Standard Bits]]
In the Systainer01 note I added a dataview query:
LIST accessories
WHERE contains(place, link(this.file.name))
This gives me exactly the result as described above.
I found this solution while studying the dataview tutorials and this forum:
BUT …
Bottum-up approach
I absolutely do not like the idea of adding accessories to the tool notes for several reasons. So, I rather want to add the relationship within the accessory note. It would make sense to me when the field name is just the same (place), e.g. frontmatter for Battery note:
place: [[Cordless Screwdriver]]
Remark: This means that the battery literally is attached to the tool and subsequently the battery inherits the place of the tool. Once I decide to attach the battery to some other tool, I want to change the frontmatter of the battery note to assign a different place.
The frontmatter of the Cordless Screwdriver note needs to be changed accordingly, so I removed the field “accessories” and it looks like this now.
place: [[Systainer01]]
The goal now is the same as described above.
My dataview query is:
LIST
WHERE contains(place, link(this.file.name))
My result is:
# Systainer01
- Cordless Screwdriver
- Dry Marker
- Ruler
The tools are shown but the accessories are missing.
My question
How do I need to modify the dataview query in order to see the accessories between the related tools?
As much as I understand I need some loop which checks for each tool whether accessories are related to it. If yes than below the tool, the accessories should be shown. I just can’t figure out what needs to be done to achieve this.
I’m grateful for any advise regarding this.