up:: ๐งช Code Diary
type:: #log/code
tags:: #on/snippets
language:: Dataview
program:: Obsidian
topics:: Coding
Language:: Dataview
Program:: Obsidian
Link::
Display random notes using Dataview JS
const numberToShow = 5;
const notes = dv.pages('#๐/๐ and -"Calendar"')
.sort(() => 0.5 - Math.random())
.slice (0, numberToShow)
.map (note => note.file.link);
dv.list(notes);
[!code] Result
Evaluation Error: SyntaxError: Unexpected token '>'at DataviewInlineApi.eval (plugin:dataview:18885:21)
at evalInContext (plugin:dataview:18886:7)
at asyncEvalInContext (plugin:dataview:18896:32)
at DataviewJSRenderer.render (plugin:dataview:18922:19)
at DataviewJSRenderer.onload (plugin:dataview:18464:14)
at e.load (app://obsidian.md/app.js:1:1166749)
at DataviewApi.executeJs (plugin:dataview:19465:18)
at DataviewCompiler.eval (plugin:digitalgarden:10760:23)
at Generator.next (<anonymous>)
at eval (plugin:digitalgarden:90:61)
at new Promise (<anonymous>)
at __async (plugin:digitalgarden:74:10)
at eval (plugin:digitalgarden:10699:41)
at GardenPageCompiler.eval (plugin:digitalgarden:17175:50)
at Generator.next (<anonymous>)
at eval (plugin:digitalgarden:90:61)
at new Promise (<anonymous>)
at __async (plugin:digitalgarden:74:10)
at eval (plugin:digitalgarden:17173:50)
at GardenPageCompiler.eval (plugin:digitalgarden:17126:36)
at Generator.next (<anonymous>)
at fulfilled (plugin:digitalgarden:77:24)
up:: ๐งช Code Diary