Dataview queries in templates


I’m reworking my templates for the Zettelkasten part of my vault. I want to give links semantic meaning using Dataview inline fields. The idea is to build a foundation for a better workflow, where I not only link a fleeting note to a permanent note, but also some information on how the two related to each other.

As one example, I want to differentiate between fleeting notes that are not yet incorporated into the permanent note it links to and the fleeting notes that are.

To do this, I’ve two inline fields in my Zettelkasten notes template: inbox:: and used::.

Based on these to fields, I want to create two Dataview queries as well. I’ve figured out how to do this in a “static way”, where I add the filename of the current note manually. But how can I edit the query below do be dynamic in my note template so that the WHERE clause is automatically searching for the specific file?

Somewhat related: Is it better to have multiple values in an inline field as in the screenshot above, or is it better to add the inline field multiple times?


Try with

WHERE contains(inbox,

It depends. But to join multiple values in one line field entry you need to follow the right syntax. By default the right syntax is:

key:: "value 1", "value 2"

But for links, numbers, tags and dates you can ignore the quotes… but to be a list/array of values you need to use the comma.

key:: [[link 1]], [[link 2]]
1 Like

Excellent, thanks!

When would to go for multiple values for an inline field and when would repeating the field make sense?

If you’re working in a way to concentrate metadata in a single place with a simple values (links, in your case), maybe it make senses to use only one entry (but in certain cases, if the value is a long string, for readability purposes, maybe it’s more interesting to add multiple entries).

If you’re working in fluid way with metadata dispersed in your note, it makes more sense to add multiple entries.

This to say: it depends in your workflow, because in relation with the metadata structure it’s the same.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.