Dataview inline queries as dynamic YAML parameter?

what I’m trying to do

I want to make a project management system with the following parameters:
status: either in progress or completed
progress: percentage of the tasks completed
overdue: I weekly check my progress on projects, so having passed 7 days after the completion of the most recent finished task, it’ll inform me that the project needs a revision (it is overdue) with either true or false
I have created the following inline queries and attached them to a YAML metadata in the frontmatter

[status:: = choice(all(this.file.tasks.completed), "Completed", "In Progress")]
[progress:: = join(list(round(length(filter(this.file.tasks.completed, (t) => t = true)) / length(this.file.tasks.text) * 100, 2), "%"),"")]
[overdue:: = none(filter(this.file.tasks.completion, (t) => t > (date(today) - dur(7 d) ) ) )]

They work perfectly on the page, but when I try to use the metadata to query in my project dashboard, it retrieves either null or the true outcome:

TABLE status, "<progress value='" + (length(filter(file.tasks.completed, (t) => t = true)) / length(file.tasks.text)) * 100 + "' max='100'></progress>" AS Progress
FROM "archive/projects"

TLDR

I only want to know if something as using inline dataview query is compatible with YAML, and what could I do instead

1 Like

(sorry, but this will be a fast answer… if you want we can develop the matter in later answers)

The use of inline queries as values for fields is problematic.
Why?

  1. Taking the status:: example, the value in the field is the expression = choice(all(this.file.tasks.completed), "Completed", "In Progress"), not in first moment the output result of the inline query. So, when you run the table query in other note, you’re running by “magic” two queries at the same time (because, i repeat, in first moment the value in status is the inline expression, not the supposed output value).
  2. This is problematic in multiple ways. The main issue is related with the use of this - or dv.current() in js queries. Remember, the read value in status contains this.file.tasks.completed… so, in the note where you are running the table query, which is the current note? Exactly, is your dashboard note, not the castellano proyecto (castellano, no español).
  3. You can solve this replacing this with the note link - instead of this.file.tasks.completed you can use [[proyecto]].file.tasks.completed. But, sincerely, you can also ignore the field status and construct the wanted value directly in the table query:
TABLE choice(all(file.tasks.completed), "Completed", "In Progress") AS status, ...

Ohhh, yeah that’s the solution!!! I was way too stubborn in making dynamic YAML fields that I couldn’t change the focus of the problem, thanks a lot <333

wow perfect solution. and i want to ask you something too. im planning to do exact same think with my subprojects instead of tasks. in the bottomest step there will be tasks and above step will be connected to bottomest steps and getting data from these pages and calculate them like tasks but i have no idea how to do that.