Dataview that Presents Files from Current File as Table

What I’m trying to do

Hi all,

I’m using Obsidian for some days now and I’m quite impressed. I hope my question wasn’t answered here already. I couldn’t find an answer neither in this forum nor using google.

I’m writing a playbook for handling re-occuring sets of tasks. In Obsidian I would like to use one file per playbook. An example for a playbook could look like this:

# Planning a party

## Part 1 - Location
- [x ] Check budget
- [ x] Align with X
- [ ] Book location

## Part 2 - Invites
- [x] Design invitations
- [ ] Make a list of guests
...

At the top of the playbook I would like to have a table which gives me a summary of the actual status and looks like this:

Heading | items completed | overall items
Part 1 - Location | 2 | 3
Part 2 - Invites | 1 | 2

What I tried

I would prefere to use a dataview due to the fact that I have already created some queries with it. Unluckily I’m a JS noob, so all I get is a list of tasks as table, using the following dataview

TABLE WITHOUT ID regexreplace(Tasks.text, "\[.*$", "") AS Task, choice(Tasks.completed, "completed", "incompleted") AS Status
WHERE file.tasks AND file.name = this.file.name
FLATTEN file.tasks AS Tasks

Any help would be really appreciated.

I don’t have time to write out a full explanation, but my suggestion would be to look into the Tasks plugin: GitHub - obsidian-tasks-group/obsidian-tasks: Task management for the Obsidian knowledge base.

A table related to data in the current file:

TABLE WITHOUT ID
	Heading,
	length(filter(rows.Tasks, (r) => r.completed)) AS "items completed",
	length(rows.Tasks) AS "overall items"
WHERE file.path = this.file.path
FLATTEN file.tasks as Tasks
GROUP BY meta(Tasks.section).subpath AS Heading

Question: why you use regexreplace(Tasks.text, "\[.*$", "") in your initial query? Copied from other post?

1 Like

Yep.

Works perfectly fine. Thanks so much!

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