Learn the Basics¶
This page shall guide you if you are a newcomer to the power of Dataview. Before you start out, make sure you made yourself familiar with the official Documentation. While the documentation is not the most intuitive guide, it's important to get a grasp of the general idea and functionality to enable you writing your own queries.
Understanding meta data on notes¶
Before you can start querying data from your vault, you need meta data to query. While there is already some information available on your notes and tasks, to leverage the full power of dataview, you'll need to add your own meta data via the frontmatter or inline fields.
Learn more about Inline fields in the dataview documentation .
Basic Structure of Queries¶
A dataview query consists of following parts - in following order:
- exactly one Query Type
- depending on Query Type, zero, one or many additional properties for displaying
- zero or one FROM data command
- zero to many other data commands.
For more info about the general structure, refer to the documentation.
Understanding Query Types¶
The type of a query determines the format of your final output. We put together some basic examples you can play around with:
Understanding Data Commands¶
Beside the four types of a query, you can use data commands to filter and enhance your query. There are some specialties to be aware of to successfully use them.
- FROM determines which notes to initially collect for your query depending on given sources
- WHERE lets you filter notes based on information inside notes, i.e. meta data.
- GROUP BY lets you bundle up notes as one "result row" depending on a property (or calculation). See Example GROUP BY Queries for example usages.
- FLATTEN does the opposite of
GROUP BY- instead of bundling up, it splits notes depending on a property (or calculation). See Example FLATTEN Queries for example usages.
- SORT sorts your result data depending on a property and a direction.
- LIMIT lets you crop your result data to a desired (maximum) number.
Understanding Inline Queries¶