Thank you for your effort, but
unfortunately not.
this is what dvjs spat out:
Evaluation Error: TypeError: Cannot read properties of undefined (reading 'path')
at eval (eval at <anonymous> (plugin:dataview), <anonymous>:11:57)
at Array.map (<anonymous>)
at Proxy.map (plugin:dataview:8038:39)
at eval (eval at <anonymous> (plugin:dataview), <anonymous>:11:14)
at DataviewInlineApi.eval (plugin:dataview:18404:16)
at evalInContext (plugin:dataview:18405:7)
at asyncEvalInContext (plugin:dataview:18415:32)
at DataviewJSRenderer.render (plugin:dataview:18436:19)
at DataviewJSRenderer.onload (plugin:dataview:18020:14)
at e.load (app://obsidian.md/app.js:1:631581)
my whole code:
```dataviewjs
let groups = dv.pages("[[]]")
.groupBy(p => p.objekttype)
for (let group of groups.sort(g => g.key, 'asc')) {
dv.header(2, group.key);
dv.table(
["file", "image"],
group.rows
.sort(k => k.objekttype, 'asc')
.map(k => [k.file.link, dv.fileLink(k.image.path, true, 150)]))
}
```
thank you!
yes, that throws me every image in that folder in size 150.
How do I implement this in my code above, to show only the requested files (images)…?
Every page captured by dv.pages("[[]]") should have an image variable. If one page captured don’t have defined image, you’ll get the error shown before.
To fix it, only select the pages that have the variable defined:
let groups = dv.pages("[[]]").where( p => p.image)
Oh yes, that looks good. thank you very much!
But could it be modified, so that those objekttypes, that do not have a picture also appear? in other words, simply display nothing (“”) …?
```dataviewjs
let groups = dv.pages("[[]]")
.groupBy(p => p.objekttype)
function ifimage(image) {
if (image)
return dv.fileLink(k.image.path, true, 50)
else
return ""
}
for (let group of groups.sort(g => g.key, 'asc')) {
dv.header(2, group.key);
dv.table(
["Datei", "image"],
group.rows
.sort(k => k.objekttype, 'asc')
.map(k => [k.file.link, ifimage(k.image)]))
}
```
but DVJS mocks about the path:
Evaluation Error: TypeError: Cannot read properties of undefined (reading 'path')...```
too bad, would have been too easy... :slightly_smiling_face:
or where is my error of reasoning here?