Im trying to make two dataview queries into two dataviewjs inline queries so I can use them to calculate the progress of projects.
But I feel that maybe that isn’t even the best way to achieve my goal. What I really want is to view the progress of projects (calculated by amount of tasks done / total tasks) alongside additional information of the project in a dataview table. The only way I can think of calculating the projects progress would be grouping the tasks and thus not be able to provide additional information about a project. Hence I want to stuff this query in an inline metadata field to be able to display in the dataview table. Since you can’t reduce dataview queries to an inline field I’m trying to convert the queries to inline dvjs queries, but im way out of my depth here.
The first query is:
TABLE WITHOUT ID (sum(map(rows, (r) => choice(r.klaar= true, 1, 0))) / length(rows.klaar)) * 100 as "Voortgang %" From "Projecten/Taken" Where contains(file.outlinks, this.file.link) Group by true
This query is modified from another user on the forum which does provide a dataviewjs query, but I can’t figure out how to modify it and make an inline dataviewjs field out of it.
This query searches for tasks linked to a project with
klaar being the status of the tasks which can be empty or true.
The second query is placed in a metaproject that has multiple projects linking to it. It calculates its progress based on the number provided in
voortgang. This is the inline metadata field that is the previous’ query output. Maybe I shouldn’t use the output of the previous query to calculate the average progress, but I should grab all the tasks from the projects linked to the metaproject and calculate progress the same as in the previous query. But I tried doing that and just discovered after a frustratingly long time that im way out of my depth here.
TABLE WITHOUT ID (sum(nonnull(rows.voortgang))) / length(nonnull(rows.voortgang)) AS "Voortgang%" From "Projecten/Project" Flatten array( map( this.file.outlinks, (il) => contains(file.outlinks, il) )) as matches Where file.outlinks and any(matches) = true Group by true
I’ve tried a long time to figure it out for myself, I’m not one to ask for help, but I’m way out of my depth here. I even tried asking chatGPT for some help but that worked miserably.
Even suggesting a better way to tackle this problem (which there certaintly is) would go a long way for me.