Your idea to filter all in-links for the ones that are in specified properties would work. Another probably more efficient way is to begin with only the values in Associated project and Parent projects, and then filtering out if they don’t lead to this project.
To begin with, this filter returns notes that are direct children of this note:
childOfHere: note["Parent projects"].contains(this)
Now for the “manual” method, where you would extend the pattern to however many degrees of descendants you want.
associatesHere: note["Associated project"].contains(this)
parentAssociatesHere: note["Associated project"].map(value.asFile().properties["Parent projects"].contains(this))
grandparentSssociatesHere: note["Associated project"].map(value.asFile().properties["Parent projects"].map(value.asFile().properties["Parent projects"].contains(this)))
Filters for thought
I suspect that the above would be good for your setup. But here’s more info if you want to play with other options.
Were your link-sequence represented in a text-type property, returning n + 1 generations of descendants would be quite straightforward, where you merely enter a number for n into this filter’s repeat(n):
" ".repeat(n).split("").reduce(
if(
acc == this || acc.isEmpty(),
acc,
acc.asFile().properties["your property"]
), note["your property"]
) == this
It becomes more complex because…
- You have two propertie. So you would OR the filter with another version that connects to a
map for the final Parent project connection.
- You’re using lists. You would need to change
== evaluations to contains and, I think, use a nested repeat. Double-emphasis on I think because I’m thinking as I’m explaining and haven’t planned it out entirely.
If you were willing to adapt either your structure or the above filter, you might have a method where you wouldn’t have to add a bunch of additional, increasingly longer filters. Just one or two filters ought to capture a nice long chain of links.