Dynamic base doesn't work

What I’m trying to do

I want to create a dynamic base that I can embed in various notes, so that it displays note-specific content wherever it is embedded.

Things I have tried

Concrete example:

I have a note called “Source” with the following content / property:

---
test: "[[super note]]"
---

Then I have a base called “base” with the following content:

filters:
  and:
    - test.contains(link(this.file.name))
views:
  - type: table
    name: Table
    order:
      - file.name
    sort: []
    limit: 15

And then I have a note called “super note”, in which I embed this base using ![[base]].

Unfortunately, the note “Source” does not show up in the embedded base…

Where is the mistake here?

Many thanks in advance!!!

Hi!

That might be a typo, but in case you really are embedding with ![[base]], change it to ![[base.base]].

Otherwise, the filter you have looks like it would work. You could simplify it to

test == this.file

Even if you already tried that then expanded it while trying to get it to work, give it another go. If it still doesn’t work, then the issue might be something other than the filter.

Is either of those notes in an excluded folder (Files and links > Excluded files)? Or do you have multiple notes named “Source” (maybe Bases is disambiguating to the wrong file)? Or is the base already returning 15 results (the limit you set), and “Source.md” would be 16th or later?

Thank you very much for your answer and your detailed questions!!! :slight_smile:

Wow, here is something interesting:
In my example above, I didn’t use a .base-file. Instead I used a normal note, with the base codeblock in it. That didn’t work, not with my filter above nor with your filter (test == this.file).
But if I use a .base-file with these filters, the embedded ![[base.base]] returns the Source-note.

Is that a bug in bases? the codeblock and the .base-files should work here the same way, or shouldn’t they?

Ah, good find. Now it makes sense.

My understanding is that it’s intended. A code-block base is intrinsically an embedded base, and this always refers to the directly embedding file.

So like, were we to embed some.base in note A, embed note A in note B, then embed B in C, some.base’s this will consistently point to note A.

source: Bases syntax - Access properties with this - Obsidian Help