Dataviewjs filtering


I’m trying to run a dataviewjs query (as Dataview Query Language does not support what I was trying to do apparently). I managed to have a very basic query running, but I need to exclude some results.

I’v read it is done through the .where() function, but I can not find documentation about how it works on Dataview.

it basically works the same way that filter() does in javascript, and is available when operating on page/pages

My idea was: give it a list of pages, check each one for the value of a specific property and only keep pages where the value is in a list of specific items.

so something like:

let foo = ["some","values","to","test"]
dv.pages('#mytag AND !"template"').where(x => foo.contains(x.myproperty) )
1 Like

That’s perfect, thanks.

1 Like

you’re welcome! I think this sort of thing is still possible in regular dataview if you use contains(), but it’s never a bad thing to learn dataviewjs as it does allow for a lot more control

I unfortunately had to use dataviewjs because I needed results grouped and under headers.