Hi. I need to calculate values that I want to display on my page at different spots.
I have a set of Modifier pages, which contain metadata like hp-modifier and speed-modifier.
I want to sum up all of the hps and speeds.
Using DQL I managed to calculate the values, but I cannot store them, to dispay them on various different places. Also a plus would be if I could query these values. So i want to store them as metadata. My DQL expression:
TABLE WITHOUT ID
sum(map(rows, (r) => default(r.hp-modifier, 0))) + this.STR AS "HP",
sum(map(rows, (r) => default(r.speed-modifier, 0))) + this.DEX AS "SPEED"
FROM "Worlds/Compendium/Modifiers"
WHERE contains(this.modifiers, file.link)
GROUP BY true
Is there a way to add multiple metadata fields to my page in one block.
An alternative would be using inline dataviewjs like so:
[hp:: $= dv.query(<DQL>)], but this would have to run the query for all the new fields.
I ended up using obsidian’s processFrontMatter function and it works perfectly.
This is what I ended up with and I’m very happy with the results. This code adds together the values and lists of the given property names and adds them to the frontmatter of one file.