Using dataview, I’m trying to generate a table of pages that have open tasks and display the number of incomplete tasks per page. I am having a lot of trouble getting this to work.
Things I have tried
I have reviewed dataview’s documentation, watched youtube videos, etc., went through the snippet showcase, but cannot find anyone who has done this. Is this even possible?
What I’m trying to do
Not the prettiest way to write this, but the below filters a page’s task list to uncompleted tasks and then uses length on the filtered list to count them.
TABLE length(filter(file.tasks, (t) => !t.completed)) AS "Uncompleted"
WHERE file.tasks AND length(file.tasks) > 0 AND length(filter(file.tasks, (t) => !t.completed)) > 0
I am not sure all the parts of the WHERE line are necessary - the part after the last AND is the one that is limiting the table to show only pages with some incomplete tasks, but if you get an error or an unexpected result you can use only some of the pieces as you investigate.
Hopefully this gives you a starting point!
Good stuff - definitely a strong starting point.
Any recommendations on where to dig in deeper on the filter functions and other functions within Dataview? I’ve looked at the docs, but they are pretty unhelpful with these more advanced functions. Most videos I’ve watched cover all the basics of DV without a lot of in-depth or more complex queries…
I appreciate the head start on this one!
name-of-array.filter(arrow-function) while Dataview’s is
filter(name-of-array, arrow-function) like I did above. I almost always check back to the Dataview documentation page for how to write these functions down.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.