Dataview help

Things I have tried

Read (many, not all…) posts on this forum and on Dev’s Github
Googled quite a lot

What I’m trying to do

I’m new to Obsidian (using Roam, you know…), and in order to understand if this tool is for me I decided to use it “on the field” for preparing a 4-hour course I’ll give on sept 7th. I already have all papers/materials/links and already “know” the topic, so I think it can be a good occasion to focus on the tool and not on the content.

I created a file called “eBiblioteca” (I’m italian) in which Dataview updates a table “automaGically” each time a new note is created in one specific folder (/Biblioteca/Note). Here’s the code:

TABLE Autore, Titolo, Type AS "Tipologia"
FROM "Biblioteca/Note" AND !"Templates"

(Of course I pre-populated the notes with YAML headings containing “Autore, Titolo” and so on…)

Now, the “tricky” part. I would like to exclude from this table each and any file whose name contains a word (“Canto”, in my present needs, but may vary in the future).
I tried with WHERE != contains (, "Canto"), no way. I even tried some wildcards (e.g. WHERE != contains (, "* Canto"): again, no way.

Is it possible to achieve this result using the “normal” dataview language or do I have to use Dataview Java?

As you can easily guess, I’m totally new to Dataview and maybe to querying logic too…
Any help would greatly be appreciated!

PS: I did a temporary workaround, moving the files I don’t want to be included in the “eBiblioteca” table in a “not queried” folder, but I would like to be able to do the trick without moving notes, if possible…

PPS: I’m primarily looking for someone who could explain me how to reach the result more than simply posting the right code (which, of course, would be very appreciated), thanks!

As you can see in plugin documentation, the function contains not require any object/string previously. So, no need to repeat outside the function contains (or !contains). It works with the expression:

WHERE !contains(, "Canto")

There are other expressions as econtains and, in the last version 0.4.5), containsword, but I do not try these still.

Spero che questa risposta sia soddisfacente! :slight_smile:


Grazie mille!!!

Thanks a lot for your documented answer: that’s what I was looking for.
And thanks for the snippet of code. Of course it works. My fault (as I said I’m quite new to query logic…) was not to try the exclusion “!” before the command…

I’ll try using the econtains and containsword in a test note and report back, if someone finds it useful.

Thanks for the link to Dataview documentation: I read it but couldn’t find any useful (to me, of course) information. I’ll have to study a bit more about this topic, but maybe after september teventh… :sweat_smile:

Risposta più che ottima e graditissima, davvero!

PS: one more thing I learned from your answer: if I want to exclude another word from query I just need to replicate the WHERE instruction as much as I need. It’s even valid for a single note, provided the string is exactly the name of the, like this:

TABLE Autore, Titolo, Type AS "Tipologia"
FROM "Biblioteca/Note" AND !"Templates"
WHERE !contains(, "Canto")
WHERE !contains(, "Divina Commedia - Testo Con link")


1 Like


TABLE Autore, Titolo, Type AS "Tipologia"
FROM "Biblioteca/Note" AND !"Templates"
WHERE !contains(, "Canto") AND !contains(, "Divina Commedia - Testo Con link")

Dante’s La Divina Commedia … love that example! :+1: :slight_smile: Glad you got it solved!

1 Like

Your solution is surely elegant and “computer-logic friendly”: I learned another important thing.


As this query is going to grow as I use Obsidian, I’m happy I can simply add lines starting with “WHERE”, just to keep control of what I’m excluding/including

It’s something more than an example… it’s a part of the talk I’ll give in a few (too few…) days…
Anyway: thanks for your appreciation :blush:

1 Like

It’s me again… asking for another help on querying.
This time I would like to use the “containword” @mnvwvnm mentioned above, but I can’t figure out its syntax.
I would like to create a table reporting all notes containing “sperimentazione”, and, according to what I learned up to now, I wrote this:

FROM "Biblioteca"
WHERE containsword("sperimentazione") = true

In preview mode it returns me an error:

                - No implementation of 'containsword' found for arguments: string
- No implementation of 'containsword' found for arguments: string
- No implementation of 'containsword' found for arguments: string

No error when I insert two arguments in the brackets, like this:

FROM "Biblioteca"
WHERE containsword("sperimentazione", "storia") = true

But in preview mode: Dataview: Query returned 0 results., and of course I created a (fake) note containing just this phrase: “Parliamo di storia della sperimentazione”.

I feel I don’t get the point…
Thanks to anyone willing to give me some hints!!!


As much as I know, query content is on roadmap but not yet implemented, i.e., for now dataview queries are limited to data (via yaml frontmatter, inline-fields, implicit metadata).
By your explanation, I deduce you are trying query the content. If not, if is a value in a field like riassunto: Parliamo di storia della sperimentazione, then you can write:

WHERE containsword(riassunto, "storia")

What’s the difference between contains and containsword?
From what I understand so far, contains checks all elements (characters) in the value, with no distinction if is a word or just some characters put together (in your example you can check ‘toria’ and dataview found it in “Parliamo di storia della sperimentazione”).
But containsword seems to be more accurate and looks for case-insensitive precise word matches in a sentence (in your example you can write containsword(riassunto, "parliamo")).

Solo un’altra osservazione.
When you find in the documentation expressions like contains(file, "ctime") = true the = true isn’t to be placed in the query, is just to explain what the function does - in this case is a filter to dataview evaluate if the clause <contains(file, “ctime”)> is true (if not, dataview didn’t yields/shows the pages).

Tornando al punto di partenza.
If you want to filter/check the content, for now I think that is not possible with dataview (maybe with dataviewjs… but I don’t have knowledge in java).

1 Like

Ciao, @mnvwvnm ! Grazie per la tua risposta!!!

Actually I’m trying to perform a “full-text” query, i.e. “find any note containing word ABC”.
I got the difference between “contains” and “containsword”, thank you!

I really appreciate your help, as it helps me learning how to deal with this powerful plugin, and, in general, to consider whether Obsidian will be my tool for some more time or if I should deprecate it.

About full-text search, I don’t know if you already know it, but you can embed global search results in your note:


Not the “finest” way, but it works.

1 Like

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