I’m trying to filter files based on two property fields
I have two meta-bind drop downs: Type & Provincie
I would like to see data based on:
Type (only type)
Provincie (only provincie)
Type and provincie
Things I have tried
Played around with all possible (for me) options of AND or OR and ()
Type works alone
Provincie works alone
Setting both values gives me all of Type & Provincie ( I need the exact match of both)
Table type, gemeente, provincie, tags AS Status
from #foto AND -#foto/fotowalk AND -#foto/done AND -#foto/lookback
where type = this.file.frontmatter.type OR
provincie = this.file.frontmatter.provincie OR
(type = this.file.frontmatter.type AND provincie = this.file.frontmatter.provincie)
AND file.name != "Foto - To Visit"
Not sure if this is even possible ( tried even chatGPT)
```dataview
Table type, gemeente, provincie, tags AS Status
from #foto AND -#foto/fotowalk AND -#foto/done AND -#foto/lookback
where file.name != "Foto - To Visit"
AND (type = this.type OR provincie = this.provincie)
```
But it do depend on the type and provincie being single value properties. If they’re lists in either the file you have this query in, or in the common file set, you need a different query.
So if the query above doesn’t work, please show some examples on typical values for type, this.type, provincie and this.provincie.
It might that the issue is that the query is to open if you don’t give that category a value, so try this instead as it seems to work for my simple test cases:
```dataview
TABLE type, provincie
WHERE file.name != "Foto - To Visit"
AND (this.type = null OR type = this.type)
AND (this.provincie = null OR provincie = this.provincie)
```
The reasoning is that we only display a file:
it it’s not the current file
and either the type is not set, or identical to that of the file
and either the provincie is not set, or identical to that of the file
This might still show to many files, if some of your files doesn’t have set a value of either of the properties. In that case you should change the meta-binds in the query file to have an extra value for “all” , and change the this.type = null to this.type = "all and similar for provincie.