Dataview query question: WHERE ... = this page

What I’m trying to do

I am trying to list all the notes from my Notes folder where the value for Organization equals the name of the page containing the query, so that the same query would list all notes for [[Org A]] on the [[Org A]] page and all the notes for [[Org B]] are listed on the [[Org B]] page.

Instead of making a unique query for each unique page, like on page Org A:

TABLE Date, Type, Number FROM "Notes"
WHERE contains(Organization, [[Org A]])
SORT Year asc

and on page Org B:

TABLE Date, Type, Number FROM "Notes"
WHERE contains(Organization, [[Org B]])
SORT Year asc

What I’ve tried

TABLE Date, Type, Number FROM "Notes"
WHERE contains(Organization, this.file.name)
SORT Year asc

First question: what’s your field format? yaml, inline. how do you write the link in the field?

Something like this?

2 Likes

Perhaps…

```dataview
TABLE Date, Type, Number FROM "Notes"
WHERE contains(Organization, [[#]])
SORT Year asc
```

Angel

1 Like

@anon12638239 and @Craig
All valid answers :slight_smile:
But if in yaml field the value is placed in this format

---
Organization: [[Org A]]
---

it doesn’t work (because in yaml fields links need quotation marks).

2 Likes

Awwwww, I am useless. :crazy_face:

Angel :innocent:

2 Likes

On the contrary, on the contrary (now @Koen have all the issues covered).
I’m used to start by previous steps to avoid unnecessary replies as “It doesn’t work”. :slight_smile:

2 Likes

Thank you for the swift and super helpful response!!

1 Like

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