Issues with context aware embedded base: Searching for files with tags by this.tags

What I’m trying to do

I have my base view embedded in another note, which has the yaml property ‘tags’ as a list. Now I’m trying to make it search in all of my clippings for any notes sharing the same tags + others, but it is failing to find anything. Does anyone know what I am missing?

Things I have tried

Attempted converting ‘this.tags’ into a list so that I can use some variant of ‘file.hasTags()’. However, this.tags creates some kind of list format when hasTag wants a string.

Closest I got is something like: file.hasTag(this.Tags.toString().replace(/#/g, ‘’)), but I don’t know how to encase each tag in quotations (eg, “A”, “B”). Seems to work when single tags are under ‘this.Tags’.

I thought file.hasTag(‘"’ + this.Tags.toString().replace(/#/g, ‘’).replace(/, /g, ‘", "’) + ‘"’) would work, but using it as a filter doesn’t pull anything.

Try

file.tags.containsAny(this.tags)

I thought I tried that…

Modified it slightly with ‘containsAll’ to get it to search for combinations of the tags! Thanks a lot, feels silly now since I spent a little over an hour trying to understand this!

file.tags.containsAll(this.tags)

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