TABLE
"<progress value='" + (length(filter(file.tasks.completed, (t) => t = true)) / length(file.tasks.text)) * 100 + "' max='100'></progress>" AS Progress
from "BOOKS"
to create a dataview table with a progress bar, where it uses the number of completed tasks/total tasks.
What I’m trying to do
When I mark “Story 1” as completed, I want Task 1 in the “Books” note to automatically be marked as completed as well. This should then update the progress bar in the “Books” note accordingly.
Things I have tried
I’ve tried using TASK with dataview, but it is not what I wanted.
I also tried searching for keywords like “dynamic task status” “task properties linked notes”, but couldn’t find anything helpful to me.
Any suggestions or example scripts on how this can be achieved? Any help would be greatly appreciated!
I can think of two different approaches to your issue. One is simple and readily available, and the other is slightly more advanced but possibly more visually pleasing…
Using tasks in the story notes
I think this is the one you’d like to avoid, and that is to actually place a dedicated task regarding completion within each story note. So that Story 1 actually contains a task asking whether this is completed.
This would allow for a simple task query in the books note, and any updating of that would automatically transfer into the story notes due to how task queries within Dataview works.
Having the actual tasks within the book note however would not easily translate into anything shown in each story note unless you do some magic somewhere…
The downside of this solution is of course that the story notes would have the task displayed within the note itself (unless you add some CSS to hide it which isn’t very hard)
Using the metadata in the story notes
It’s possible to use a property within the story notes to store the status of each story note completion status, but building the query to toggle that status from the book note gets slightly more complicated.
In the thread below I’ve done similar stuff where you have a query toggling the addition/removal of a tag, or the changing of a property through the table. It do require a little scripting, and a query to list out which notes are the corresponding book notes, but it shouldn’t be too hard to adapt to your situation if you’ve the story notes query.
In other words, it kind of comes down to how advanced a solution you want, and the visual appearance of that solution. In the latter case you’ll get a list of story notes related to the book note, and can click on which story note you’ve completed, and that result is stored within the story note itself in the properties.
In the first case, you’ll have a task in the story note depicting the completeness of that part, and a much easier query within your book note. Still allowing you to complete the story note from within the book note.