Project tracking(Metaedit, Dataview and Kanban)

By using metaedit, dataview and Kanban, now we could track all us projects with a progress-bar. Watch video here: https://youtu.be/TbWdI-trdvo

First, you should set metaedit plugin like (for make metaedit autoupdate variable):

Then, put these into your Kanban’s YAML Frontmatter:

Title: /*(Set anything if you want)*/
kanban-plugin: basic
tag: projects
Total: /*(Metaedit will auto-update these variable)*/
Incomplete: 
Completed: 

Finally, put code below into your project tracking note:

```dataviewjs
function projectTracker(dv, query) {
    let searchPagePaths = dv.pages(query).file.path
    
    for(let i=0; i < searchPagePaths.length; i++){
        if(dv.page(searchPagePaths[i]).Total){
                    let title = dv.page(searchPagePaths[i]).Title;
                    console
                    let total = dv.page(searchPagePaths[i]).Total;
                    let status = ((dv.page(searchPagePaths[i]).Completed / dv.page(searchPagePaths[i]).Total) * 100).toFixed();
                    const progress = "![pb|500](https://progress-bar.dev/" + status + "/?scale=" + "100" + "&title=" + title + "&width=400)"; //you could set any width if you need
                    dv.paragraph(progress);
                    dv.paragraph("<br>"); //use this if you have many projects to track.
        }
    }
} 

projectTracker(
    dv,
    "#projects" //change tag if you need
)
```

Yep, you did it. You will get something like this below:

19 Likes

Hi! This really cool! Can you walk me trough implementation? I’m not a programmer and my skills are basic…

Hey, how can i help you?

@Aonto Help needed. I am trying to do something similar but without Kanban.
I intend have Project > Sub-Project > Sub-Projects.
And have a count auto-updated and a small progressbar on each project page (autoupdated). Possible?

Yep, it will only count how many completed tasks and how many incomplete tasks.

1 Like

Hi @Aonto, thanks for the set up! I like it!

I am not comfortable with using YAML at all, and I initially had a problem with the title - I found that titles with more than one word would break the code. And I see that all your projects are one word.

  • is there a way to format the YAML Title field with more than one word?

thanks :+1:

Hi @dryice,
not sure whether you’re still looking for a solution, but I thought I’d post it anyway, as it took me a while to figure out a solution for the same question. I am not a programmer and fairly new to obsidian and dataview. What worked for me though, was to convert the YAML title using encodeURIComponent(). This works for me with YAML titles like “My perfect project”.

Here’s how I changed the code snippet from @Aonto

function projectTracker(dv, query) {
    let searchPagePaths = dv.pages(query).file.path
    
    for(let i=0; i < searchPagePaths.length; i++){
        if(dv.page(searchPagePaths[i]).Total){
                    let title = dv.page(searchPagePaths[i]).Title;
                    console
                    let total = dv.page(searchPagePaths[i]).Total;
                    let status = ((dv.page(searchPagePaths[i]).Completed / dv.page(searchPagePaths[i]).Total) * 100).toFixed();
                    const progress = "![pb|500](https://progress-bar.dev/" + status + "/?scale=" + "100" + "&title=" + encodeURIComponent(title) + "&width=400)"; 
                    dv.paragraph(progress);
                    // dv.paragraph("<br>"); 
        }
    }
} 

projectTracker(
    dv,
    "#projects" //change tag if you need
)

The Kanban YAML section looks like

---
Title: My perfect project
kanban-plugin: basic
tag: projects
Total: 2
Incomplete: 0
Completed: 2
---

The result looks like this
grafik

Hope this helps :slight_smile:

3 Likes