Show Kanban Cards in Notes Page

I’ve searched the forum and attempted to play around with Dataview, but can’t seem to figure it out.

I have the Kanban plugin and a page with several lists and 100’s of cards (e.g.)

  • Email [[BrandA]] about Features
  • Call [[BrandB]] tomorrow
  • Create Report for [[BrandA]] and [[BrandB]]
    -etc.

Is there a way, via Dataview or a query, wherein I can go to the Note Page for [[BrandA]] and see every Kanban card mentioning it? Also (via the query), how can I differentiate:
-Search all cards with BrandA
-Search for open cards for BrandA
-Search for completed cards for BrandA

What I’m trying to do

Hi.

Well, dataview, doesn’t “read” the kanban “cards”. Perhaps dataview can read metadata inside the markdown file of your kanban page (because kanban page is a md file).

First, you need to know what dataview can query: metadata, not full content. And how you can create custom metadata (mainly with inline fields).

Second, write info in your kanban cards in the way that dataview can read the metadata.

Considering Kanban has a markdown view where the cards are just tasks, is there a way to query the “tasks” within the Kanban page? Of course, only have tasks for [[BrandA]] show up in the Note for BrandA

If tasks, you can start here:

```dataview
TASK
--  options below --
WHERE contains(text, "[[BrandA]]")
```

options:

  • use FROM "your-folder-path if you have the kanban file in a specific folder
  • use FROM "your-file-path.md to define only the kanban file as source
  • use WHERE file.link = [[your-kanban-file]]

Thanks - I’d like to make the code a template (I just insert into any note). I don’t want to have to type [[BrandA]] everytime. What can i put to work? I’ve tried:

TASK
Where file.link = [[Kanban]]
Where contains(text, this.file.link)

But that doesn’t work.

TASK
Where file.link = [[Kanban]]
Where contains(text, "")

Show’s everything, and doesn’t filter.

Depending on the rigor of the desired filtering, you can try one of these:

TASK
Where file.link = [[Kanban]]
WHERE contains(text, "[[" + this.file.name + "]]")

or

TASK
Where file.link = [[Kanban]]
WHERE contains(text, this.file.name)

Here’s a complex dataviewjs query that targets tasks on a Kanban. It also matches them with the corresponding note for the card, then draws metadata from that note, and displays the actual Kanban task in a table alongside that metadata.

const readingListFilename = '⫿⫿⫿ Reading List.md' // The reading list filename
const readingListFile = dv.page(readingListFilename)
const allReadingListTasks = readingListFile.file.tasks // all incomplete readings on the reading list

let allReadingListTasksAsArray = []
for (var readingListTaskIterator = 0; readingListTaskIterator < allReadingListTasks.length; readingListTaskIterator++) {
	allReadingListTasksAsArray.push(allReadingListTasks[readingListTaskIterator].text)
}

let mostRecentlyAddedReadingItems = dv.pages('"Index"')
	.where(p => allReadingListTasksAsArray.includes("[[" + p.file.name + "]]"))
	.sort(p => (p.file.ctime.ts), 'desc')
	.slice(0, 1)
	.map((p, index) => ["`$= dv.taskList(dv.page('" + readingListFilename + "').file.tasks.where(t => t.text.includes('" + p.file.name + "')), false)`", p.minutes_to_read])

let recentTable = dv.table(["Most recently added reading list item", "Reading time in minutes"], mostRecentlyAddedReadingItems);
1 Like

Thank you! this.file.name works.

Now how do I filter only open tasks (not showing completed)?

Well, you need to read more the plugin documentation and make some tests to learn something. If not this becomes not a learning process but solutions “a la carte”.

TASK
WHERE file.link = [[Kanban]]
WHERE !completed
WHERE contains(text, "[[" + this.file.name + "]]")
1 Like

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