Formula to retrieve frontmatter property from Dataview Inline YAML

In over 1500 book notes, I have inline YAML for book covers (embeded attachment):

Cover:: ![[Pasted image 20230827112517.png|200]]

Can a formula in Bases retrieve this inline YAML and produce a link to the attachment, like:

[[Pasted image 20230827112517.png]]

so that I can use the image in the Card View layout of Bases?

You might be able to pick the images up using file.embeds[0]

Create an image called image.png, embed it in a test note, and then insert the Base queries below. The image should appear in the table and card.

This is the embedded image: ![[image.png]]

```base
formulas:
  firstimage: file.embeds[0]
  image(firstimage): |
    image(file.embeds[0])
views:
  - type: cards
    name: cards
    filters:
      and:
        - file.name == this.file.name
    order:
      - formula.firstimage
      - file.name
    image: formula.firstimage

```


```base
formulas:
  firstimage: file.embeds[0]
  image(firstimage): |
    image(file.embeds[0])
views:
  - type: table
    name: table
    filters:
      and:
        - file.name == this.file.name
    order:
      - file.name
      - formula.image(firstimage)
    columnSize:
      file.name: 209
    rowHeight: extra

```

1 Like