Render images with dataviewjs

If the ID property in any of your files has multiple entries, your solution will fail. So I hinted that you should take care of that situation somehow.

Either by removing the logic in the code segment else if (myFieldType == “array” ) { … } , or even better by adapting your change of the myField with the app.vault.getFiles()... down into either the single case or multi-case scenario as the script was originally written.

Alternatively, you could detect if the ID has multiple option, and if so bail out of the script with a proper error message.


As it stands the script in your solution will only work if it has a single value for the ID property, and any other cases will just fail silently. That’s not very robust programming, as the script originally was made out to be to try to counter for just the possibility of the field to have multiple values.

1 Like