> [!column|flex no-title]
>> [!menu-dark-red|ttl-c] [[Obsidian TTRPG Tutorials]] / [[Plugin Tutorials]] / [[Dataview]] / [[Dataview - List Party Members]]
> [!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 Party Members
This example can be placed in a note and will automatically generate a list of party members.
For this example you would have 1x note per player.
- The notes are stored in the folder: `1. The Party/Deadly Depth Inn`
- Each note has the following [[Front Matter (YAML) and Tags|Frontmatter]]. Frontmatter is listed at the top of a note between the --- and ---.
````
---
Player: [Player Name]
Class: [Class Name]
Race: [Race Name]
Level: [Level]
hp: [health points]
ac: [armor class]
modifier: [Initiative Modifier]
pasperc: [Passive Perception]
Role: Player
Status: Active
---
````
This is an example of the Frontmatter from one of the player notes.
![[Pasted image 20230529210632.png]]
In another note this can now be typed. <br>
Note that the Dataview query creates a table where the first column is the name of the Note. If you name the note after your player then this will always be the players name. You then define the column in the second line of the code. Each column is created by typing FrontmatterName, FrontmatterName2, FrontmatterName3, etc.
The third line defines the folder you are looking at. You can replace this with a #tag also.
The fourth line is a where clause that says only show me the notes where Role = Player.
The firth line is a where clause that says only show me the notes where Satus = Active.
I do this because I have other notes in this folder and sub-folders that I do not want to display in the table. Dead players for example I change to `Status: Dead` and this way they will not display in the result.
````
```dataview
table Player, Class, Race, level, Role
from "1. The Party/Deadly Depth Inn"
where (Role = "Player")
where (Status = "Active")
```
````
![[Pasted image 20230529205604.png]]
This code is basically the same as the one above except I have brought in different columns.
Line two does rename a column from `pasperc` to `Passive Perception (WIS)`.
````
```dataview
table Player, hp, ac, modifier, pasperc As "Passive Perception (WIS)"
where (Role = "Player")
where (Status = "Active")
```
````
![[Pasted image 20230529210315.png]]
Here is a slightly more advanced example.
- I did not like that the first column was called File. I wanted it represent the purpose of the column. To do this you start with:
- `TABLE WITHOUT ID link(file.name) AS "Character Name"`
- This over-rides the default column header and renames the column as "Character Name".
- Note that the "Character Name" is in quotation marks. This is because there is a space in the column name and spaces break the code. If the column was just going to be called Character then the quotation marks are not required. You can see the quotation marks are using for the renaming of pasperc also.
````
```dataview
TABLE WITHOUT ID link(file.name) AS "Character Name", Player, hp, ac, modifier, pasperc As "Passive Perception (WIS)"
where (Role = "Player")
where (Status = "Active")
```
````
![[Pasted image 20230529215920.png]]