What I’m trying to do
I am using Dataview and DBFolder to help manage my references in a table. Each row of the table contains a unique research article or other evidence source.
If I have a PDF or other attachment for a file, I’ll paste the attachment directly into the file so it is embedded and organized elsewhere. My default folder path for the attachments is an Attachments folder.
My problem is that I can’t easily tell which references have attachments embedded when looking through the table. Ideally, there would be a field that lists all embedded files for each row of the table.
Things I have tried
I first tried using the DB Folder formula field. But I have not been able to get that to work with any code (discussion on GitHub).
I’ve since been trying Metadata Menu’s formula field since it can update dynamically. This code works within a file so I’ve been trying variations of it in the formula field with no luck so far.
```dataviewjs
const {path} = dv.app.workspace.getActiveFile();
// or you could also use const path = "anyFilename.md";
const attachements = this.app.metadataCache.getCache(path).embeds;
let res = "List of attachements : </p>";
for (let att of attachements) {
res += att.link+"<br>";
}
const elt=dv.el("p",res);
```
Any ideas would be greatly appreciated!