I am building a Vault for my TTRPG campaign and I got a lot of scenes as individual notes. If a scene is played in a particular session, I will from the session’s note to the scene’s note E.g. We play scene “talk to the shopkeeper” in session 5, then the note on session 5 will contain a link to that scene.
So far, so good. In order to use Dataview to see the relations between these (and a bunch of other notes on factions, NPCs, etc.), I opted not to use metadata fields for each kind of relation between notes (e.g. having a field NPCs in a scene note that I have to manually fill with all the NPCs occuring in that scene). Instead, I am filtering by the note’s inlinks and outlinks and that works fine for almost all my needs.
I would like to generate a Dataview table where all my scene notes are listed and grouped by the sessions they linked to. Each scene note is linked to at maximum one session note.
To this end, I have constructed the query below.
TABLE string(rows.file.link) AS Scenes FROM "Scenes" WHERE contains(file.inlinks.file.name, "Session") GROUP BY string(file.inlinks) AS Sessions
It takes in all files in the “Scenes” folder whose inlinks come from a note with “Session” in the name. This way, I only get scene notes that have been linked to from a session note, i.e. that have been played out already.
I have them grouped by their inlinks and this is my trouble. This way, all inlinks are used for grouping. However, I would like to only use the session notes that link to the scene notes for the grouping.
Currently, I get a result like this one below, in which the “Meeting a Caravan” scene is grouped by both the “Session 2” note and the “Arrival on Radanaar” note which both link to it. The scenes for “Session 1” are grouped correctly because no links in other notes than the “Session 1” note point to them.
I have read the documentation of the GROUP BY data command and looked for solutions both on search engines and in this forum, but I have not found a specific enough solution for my case.
I’d be glad if someone could help me out here. Also, if you have any input how to do this whole setup differently so it works better, I’d also be happy to hear that.