Dataview question: list all notes which names contain any of the aliases of this note

Hello, when I use Obsidian Dataview, I meet a question.
There are five notes in Obsidian:

In test.md, I want to list all notes which names contain “→”, and words before “→” contain any of the aliases of this note.
So “acdflieresdk→C.md”, “believe→D.md”, “lie→d.md” should be listed.

So I tried this:

LIST 
WHERE contains(split(file.name, "→" , 1), this.file.aliases) 
AND contains(file.name, "→")

But it doesn’t work correctly.

Then I tried this:

LIST 
WHERE contains(split(file.name, "→" , 1), this.file.aliases) 

I find it will list all the notes in this vaults. I feel confused. I read Dataview documents Data Annotation - Dataview again but can’t find solution.
I know “this.file.aliases” is an array, not a value. But I don’t know how to handle this.

Any response helps.

Hi,
Indeed the problem is the “this.file.aliases” array.
Try this way:

LIST
WHERE contains(file.name, "→")
FLATTEN this.file.aliases as ALI
WHERE contains(split(file.name, "→" , 1), ALI)
2 Likes

It works. Thank you!

Oh I find that this image is not correct because the aliases contain comma.
This is the right image:

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