Hi all,
I have a couple of use cases for recursively filtering bases.
First, I’d like to list all notes that link directly to a given note. Here I’d like to also show notes that link to the notes that link to the parent note (this should be done recursively). I’ve been able to do this in dataviewjs, but I’d like to make use of base’s better performance and in-place YAML editing. Can this be done in bases?
Second, assuming this can be done, I’d like to take that recursively generated list of notes and filter another set of notes with that list. I.e., a note is only displayed in that base, if a specific property contains a link to at least one of the above generated list of notes.
The Obsidian bases documentation mentions recursive filtering but I can’t seem to find an example.
I hope this is understandable.
In any case, I’d appreciate any input.
Yes. Continue the pattern to extend to an arbitrary number of degrees.
If you plan to go far, you could change tactics to use the repeat() and reduce() functions. But note that hasLink() seems to not refresh swiftly (this is not documented; it’s just from observation), so you’ll probably end up having to manually close and reopen notes/bases to force refreshes.
@dawni thanks a lot and sorry for the late response
I can’t quite seem to figure it out yet.
Could you give me an example how to filter to include also second degree backlink neighbors to a given note?
I tried file.links.filter(value.asFile().hasLink(file.links.filter(value.asFile().hasLink(this)))) but that passes a list when hasLink expects a single link. Playing around with .some didn’t get me much further either, unfortunately.