DataviewJS CheatSheet #
If you’re an Obsidian power user, you’ve likely hit a wall pretty quickly with what raw Dataview queries can give you. Or you’re just annoyed with how much new syntax you have to learn just to get your data out in anything but the simplest manner. If that resonates with you, and you already know javascript, I’d strongly recommend only using DataViewJS for all your queries. It’s no harder than writing the queries in their custom DSL, and you can massage both the query and the view output however you like.
Some tips when working with DataView JS in Obsidian:
dv.current()
gives you the current page as represented by DataView.console.log
s go to the Obsidian dev console (accessible with Cmd + Option + I on a Mac).- You can access lists or tasks on the page using
pageData.file.lists
orpageData.file.tasks
- Inline Dataview fields show up on the list element as properties. For example, if you have a list like this
- This is a log #~"some tag" [property::value]
, you can accessproperty
usingpageData.file.lists[0].property
.
The rest of it is just scripting and iterating.