How does the filter() function work?/is using WHERE as a field possible?

What I’m Trying to Do

Essentially, I’m trying to put a WHERE statement inside a dataview field and filter a list of inlinks–AS a field–where mother-location = So, notes that link to the current note, but ONLY if they link to it throught the mother-location field.

TABLE filter(file.inlinks, mother-location =
FROM "Wiki/Locations"

This query doesn’t work, but you can probably see what I’m trying to do.

It seems so simple, and yet I just can’t figure out how this would work. I assume I need to use the filter() function, but I can’t figure out how that works, either.

Things I have tried

I’ve tried this query:

filter(file.inlinks, (x) => contains(x.mother-location, AS Sub-Locations
FROM "Wiki/Locations"

I’m not sure if I’m understanding filter() correctly, but I’m trying to filter inlinks to only those where mother-location contains the file name of the current note in the table. So, I’m kind of trying to use WHERE but as a field.

I am very confused as to how to get this working.

Not sure if I understand this correctly, probably contains() could do the trick.

from "some folder path"
where contains(metadata field,