Bases: List all backlinks to any note in a base?

I currently have a Base called “Companies” that lists six notes, each referring to a specific company. All of these have various numbers of backlinks in other notes.

Is there a way to create a new Base that lists out all the backlinked notes to any of the Companies in my original Base?

thanks!

If you intend to embed the new base in each company note, this filter will give you a list of notes that link to the company:

file.links.contains(this)

But if you want the new base to

  • stand alone (without relying on an active note),
  • show all of the companies at the same time, and
  • list all links to the companies shown

… then you could use file.backlinks in a Properties formula:

file.backlinks.map(value.asFile())

Note that using file.backlinks comes with performance drawbacks. If you decide to use backlinks anyway, then you can do things to make the display look a little better, such as:

file.backlinks.map([value.asFile(), ", "]).flat().slice(0,-1)
2 Likes

What I’m really trying to do is take all of those backlinks, aggregated across all six companies, and display them as a new base. Right now I can see all backlinks displayed in a separate column, with a line for each company. I just want to see all these backlinks combined and listed on their own. Any way to do that? Thanks again!

How do you define your company notes?

If it’s with, say, a #company tag in the contents or in the front matter, then you could do a new base with this filter:

file.links.filter(value.asFile().tags.contains("company"))

That would show all notes that link to one of your company notes. Adding that same text to a formula would then give you a table like:

Or if you define your company notes with a property along the lines of:

---
myProperty: company
---

… then you could use this as the formula and filter in the new base:

file.links.filter(value.asFile().properties.myProperty.contains("company"))

Bases’ grouping feature isn’t developed yet, but while you wait for that, you could simply sort on the formula property to get this kind of result:

1 Like

Your second example/screenshot there doesn’t show Untitled 3 associated with both company 1 and company 2, is there a way to achieve this? I’m trying to solve a very similar problem, where I want Untitled 3 to appear twice on two separate lines, once for company 1 and once for company 2. Not sure if that’s actually possible with bases though…

It doesn’t show a second link because there was no second link when I took the screenshot. I added it for the demo (I typed up the info for you then made the demos to take screencaps but in reverse order.)

All company links will show up with both methods.

But a single note won’t appear twice the way you’re thinking. Bases tables are essentially a catalog of your notes; it doesn’t repeat an entry (a note) in multiple rows.

I got my hopes up, as I thought (hoped) your underlying data was the same between both screenshots :slight_smile: Thanks for confirming re the one row = one note too, that’s what I thought was the case but couldn’t find any confirmation in the docs.

For the record I want the duplicate row so when the upcoming groupby functionality arrives, I can have company 1 / company 2 groups with that row appearing in both.

1 Like

Your first example is exactly what I was looking for. This works perfectly. Thank you!

1 Like

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