Extract field from a SQL block

JavaScript doesn’t support negative array indexes like that. You have to do it the long way around

<div class="card">${test[test.length - 1].value}</div>

or if you can use newer JS features, you can use Array.at:

<div class="card">${test.at(-1).value}</div>

You may also run into the fact that SQL cells don’t return arrays of objects, they return Arrow result objects. In this case, the code above works fine, but if you need something more familiar you can run

```js
const converted = test.toArray();
```

(by the way if you use three tildes (~) instead of three backticks you can create code blocks that can contain Framework’s triple-back-ticks)

1 Like