Filter by backlink in property

Hi! I’m stuck trying to build a personal CRM with Bases. My CRM works just fine, but i have a met property (list) in my daily notes in which I link to my #people notes. I can’t find a way to create a « Met most recently on: » column in my base.
My first need is to have a « Met on: » property. I tried met.contains(this) and it works just fine on individual people pages, but I think the this is breaking everything in Base view. I’d really appreciate some help with creating this filter!

Then I’ll need to filter to only have the most recent one, but that’s probably a stretch :sweat_smile:

I’m assuming, from your description, that your base lists the people in your CRM :sweat_smile:

So, if I’m not mistaken in the link direction you could try to use something like:

file.backlinks.filter(value.asFile().properties.met.contains(file))

Which takes the file.backlinks list and looks for files where the met frontmatter key contains a link to the people the base displays :blush:

To have only the most recent one, maybe something like this could work:

file.backlinks.sort().filter(value.asFile().properties.met.contains(file))[-1]

Similarly, it takes the file.backlinks list, sorts it and then again looks for files where the met frontmatter key contains the a link to the people the base displays … but only keeps the last links matching the filter condition :blush: .

This seems to work for daily notes formatted as YYYY-MM-DD
(I didn’t test for other formats :innocent: … which could potentially be problematic for the sorting of the file.backlinks)

2 Likes

This is perfect, thank you! Both of your assumptions (that it’s a People base and that the daily notes are YYYY-MM-DD format) were correct.
I really appreciate your help!

1 Like