How can I easily use `this` note as a source?

What I’m trying to do

I am looking for a way to use the note my query is as the source in the query, without the name of the file. I would love the this in a query such as TABLE review FROM this.

My case is as follows. I would like to gather all the questions I have in a note at the top of the note.
I have prefixed questions with question:: . So for instance, in my note, I have added

some texts. ....

question:: how do we do this?

some other text .....

question:: is it possible in a simple manner?

I want to avoid providing the whole path to the note so that if I move the note around, the dataview query remains OK.

Things I have tried

I have tried

TABLE WITHOUT ID
question AS Questions
FROM "foldername/my_note"

and it works. But if I move my note or rename it, the query is not modified automatically and therefore it breaks.

I have tried this, this.file, [[file.title]], [[file.path]] after FROM. Without success.

Any help is welcome.

Hi @wpicard you can do this by adding a WHERE clause query, and selecting FROM "".

Give this a try:


```dataview
TABLE WITHOUT ID
		question
FROM
		""
WHERE
		file.name = this.file.name
```

If the note is open when you rename it, you will get the message that Dataview: Query returned 0 results., but that’s to be expected as the WHERE clause is not met as you renamed the file. You just need to reopen the note for the query to work once more.

1 Like

U can use the following. But if u hv same file name but in different folder, both will apear.

Maybe can swap for file.link = this.file.link

TABLE WITHOUT ID
question AS Questions
WHERE file.name = this.file.name
2 Likes

Thanks. This actually works in my case.

Thanks. I have updated to file.link = this.file.link and it works nicely.

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