How to stop dataview from executing dataviewjs YAML

Things I have tried

I’ve made a simple inline formula that calculates a percentage based on tasks I have completed with a special tag (#H/):

Percentage:: $= const setFilter = "#H/"; Math.round(((dv.current().file.tasks.where(t => t.completed).where(t => t.text.includes(setFilter)).length) / (dv.current().file.tasks).where(t => t.text.includes(setFilter)).length) * 100) + "%"

I want to view this in a dataview table but when I make a table with Percentage, it calculates the percentage for the page that the table is in.

What I’m trying to do

I’m trying to see the calculated value for the page that the code is in, not the page from the dv table.

I don’t think reusing an inline field set using dataview is reliable. At least not from another dataview query on the same page.

I would rather recalculate that value from within the other query, possibly through another function or similar, depending on context.

I’m in general a little wary of defining inline fields using dataview, as I’ve so far not found a reliable way to do so, and also to avoid race conditions as to which query runs first and last.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.