> [!column|flex no-title]
>> [!menu-dark-red|ttl-c] [[Obsidian TTRPG Tutorials]] / [[Plugin Tutorials]] / [[Dataview]] / [[Dataview - List Monsters Used In Note]]
> [!column|4 no-title]
>> [!menu-green-1|ttl-c] [[Getting Started]]
>
>> [!menu-green-2|ttl-c] [[Plugin Tutorials]]
>
>> [!menu-green-3|ttl-c] [[Community Supported Games]]
>
>> [!menu-green-4|ttl-c] [[Obsidian TTRPG Tutorials/Templates/Templates\|Templates]]
> [!column|3 no-title]
>> [!patreon|ttl-c] [Patreon](https://www.patreon.com/JPlunkett) ([Starter Vault](https://www.patreon.com/posts/obsidian-patreon-96801399))
>
>> [!discord|ttl-c] [Obsidian TTRPG Community Discord](https://discord.gg/CdM9UCJdwU)
>
>> [!discord|ttl-c] [Obsidian Official Discord](https://discord.gg/8AF29UBUCa)
## List The Monsters Used In The Active Note
This example can be placed in a note and will automatically generate a list of monsters that have been linked from the current note. This is a fantastic tool if you are working with a large adventure of module. I use it to create a nice list at the top of the note that tells me instantly which miniatures I need to go get off my shelf for the current chapter.
For this example you would have 1x note per monster.
- The notes are stored in a `2. Mechanics\Beastiary\<book name>` folder but note that I do not use the folder in this query. I could, and probably should as it will make the query more efficient by reducing the number of folders it needs to index/scan in order to return the result.
- Each note has the following [[Front Matter (YAML) and Tags|Frontmatter]]. Frontmatter is listed at the top of a note between the --- and ---.
````
---
SourceType: Bestiary
---
````
Here is the Dataview code that can be copied into the active note.
The second line defines the Table. In this case all I do is rename the first column to `Monster` as the default is `File` which doesn't really fit the theme of my campaign.
The third line is the WHERE clause that says show me any notes that have an Inbound Link to this file AND they must also have the Frontmatter `SourceType: Bestiary`.
````
```dataview
TABLE WITHOUT ID link(file.name) AS Monster
WHERE contains(file.inlinks, this.file.link) AND SourceType = "Bestiary"
```
````
The returned table should look something like this.
![[Pasted image 20230529221432.png]]
You can also modify this concept. In this example I bring all the `Magic Items` that are linked from the active note. Note that I use the Frontmatter `Type` here instead of `SourceType`. This is simply because I have imported content in multiple ways and the result is I have sloppy Frontmatter. Ideally I should update all my notes to use the same names for Frontmatter across all my notes. I have thousands of notes though... so do as I say, not as I do. 🫤😁
````
```dataview
TABLE WITHOUT ID link(file.name) AS "Magic Items"
WHERE contains(file.inlinks, this.file.link) AND Type = "Magic Item"
```
````
The returned table should look something like this.
![[Pasted image 20230529221538.png]]