> [!column|flex no-title] >> [!menu-dark-red|ttl-c] [[Obsidian TTRPG Tutorials]] / [[Plugin Tutorials]] / [[Dataview]] / [[DataviewJS - Faction Reward Tracker]] > [!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) ## Example Output ![[Pasted image 20250213210409.png]] ## Faction Note Add this to the properties of your Faction Notes. ``` --- faction: "Faction Name" benefits: - standing: 1 reward: "What do they get at level 1?" - standing: 2 reward: "What do they get at level 2?" - standing: 3 reward: "What do they get at level 3?" --- ``` ## Player Note or Party Note Add this to the properties of your Player or Party Note(s). Update the folder location so that it points to the folder where you keep your Faction notes. The Faction Names need to match the names of the Factions used in the Faction Notes. ```` --- name: "Player Name" faction_standing: "Faction Name 1": 1 "Faction Name 3": 2 "Faction Name 3": 3 --- ```dataviewjs const player = dv.current(); const factions = dv.pages('"ParentFolder/FactionFolder"'); let tableData = []; for (let faction of factions) { let factionName = faction.faction; let playerStanding = player.faction_standing?.[factionName] || 0; // Ensure benefits is treated as an array let benefitsList = Array.isArray(faction.benefits) ? faction.benefits : []; // Filter benefits the player qualifies for let qualifiedBenefits = benefitsList .filter(b => playerStanding >= b.standing) .map(b => b.reward) .join(", "); tableData.push([factionName, playerStanding, qualifiedBenefits || "No benefits yet"]); } dv.table(["Faction", "Your Standing", "Benefits"], tableData); ``` ````