Using formulas as a cover in Bases card view instead of just a property

Problem

I made a way in Dataview to show an image in the dataview query from the note, by checking if a linked file is from “Attachments” folder and showing the first one

embed(filter(file.outlinks, (link) => contains(string(link), "Attachments"))[0]) AS "Cover"

This made it very simple to just import an image into the note and Dataview would automatically show the image without me entering the file link into “image” property. Now, with bases I have to do this again

Proposed solution

Allowing using formulas as covers in Bases card view

(also id appreciate if anyone could rewrite the formula for the new Bases syntax, that snippet was made by Claude Sonnet)

So, I’m not entirely sure if this will help (I haven’t used Dataview in a long while :sweat_smile:), but maybe a formula similar to this one could work:

image(file.links.filter(value.asFile().folder.contains("Attachments"))[0])

Or this:

image(file.links.filter(value.asFile().path.contains("Attachments"))[0])

You should then be able to select the formula property (well, if it works as attended :sweat_smile: ) as the Image property to use to as a “cover” for the cards :innocent:
(I could only test on iPad at the moment :blush: )

Create a formula property and then use that property as your cover. This is what I do for my ‘Base of Bases’.

Property Cover Image is file.basename + “.jpg”

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