Haitham
September 8, 2022, 5:12pm
1
Is there a way through dataview to show me only the tasks specified for a specific date and show them inside a progress bar?
example:
I want dataview to show me task 1 and task 2 from “Project A” and task 4 from “Project B”, becuase they have the same date, which is today and show them in a progress bar.
1 Like
mnvwvnm
September 8, 2022, 11:18pm
2
The example (image) doesn’t have part of the solution?
Haitham
September 9, 2022, 2:13am
3
That progress bar I did it manual, I want it to be automatically from the tasks that include a specific date.
mnvwvnm
September 9, 2022, 11:17am
4
So. Let’s try this:
In this example I use due::
instead of date::
(to avoid confusing with the function date()
.
Example md files
# Project A
- [x] task 1 [due:: 2022-09-09]
- [ ] task 2 [due:: 2022-09-09]
- [ ] task 3 [due:: 2022-09-10]
---
---
# Project B
- [x] task 4 [due:: 2022-09-09]
- [ ] task 5 [due:: 2022-09-12]
- [ ] task 6 [due:: 2022-09-15]
Daily note with the title in format YYYY-MM-DD
(ex.: 2022-09-09
):
# 2022-09-09
```dataviewjs
const myDate = dv.current().file.day.toFormat("yyyy-MM-dd")
const pages = dv.pages('"MyFolderPath"').file.tasks.where(t => t.due?.toFormat("yyyy-MM-dd") === myDate)
const total = pages.length
const done = pages.where(t => t.completed).length
const value = (done) / (total || 0) * 100
dv.paragraph("<progress value='" + value + "' max='100'></progress>" + "<br>" + value.toFixed(0) + "% completed")
```
```dataview
TASK
FROM "MyFolderPath"
WHERE due = this.file.day
```
You need to change “MyFolderPath”: folder path, a tag or …
Because I don’t know how to work properly with dates in JS I use the format conversion to facilitate the dates comparison.
The result:
6 Likes
Haitham
September 9, 2022, 12:17pm
5
It’s worked, you saved my day. Thanks a lot.
system
Closed
September 16, 2022, 12:18pm
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.