Inline JS to count incomplete tasks

Things I have tried

Try a few ways using inline JS but unsuccessful

What I’m trying to do

I am trying to show a count of number of completed tasks like the line below. But I am not able to get any result, in fact some error. Please help.

Completed tasks: $=dv.taskList(dv.pages('""').file.tasks.where(t => t.completed).length);

1 - If you want a value and not the tasks, then don’t use dv.taskList() (this is the type of query to visualize tasks)
2 - Instead, use dv.span() or dv.paragraph()

`$=dv.span(dv.pages().file.tasks.where(t => t.completed).length)`

3 - if an inline query you don’t use any:

`$=dv.pages().file.tasks.where(t => t.completed).length`
1 Like

Thanks @mnvwvnm, it works now. For 3, I did try this earlier before I posted for help. I might have missed some parts of the syntax :sweat_smile:

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