I have a long shapefile with various columns. I want to select only some rows, based on an expression. The column used for filtering is "binomial"
. I tried so far:
"binomial" = "Axis axis"
$binomial = "Axis axis"
$binomial = Axis axis
… and so on, but nothing works. After understanding this, I would like also to add more names, something such as:
$binomial = "Axis axis" and $binomial = "Dama dama"
I am not used to the coding language of QGIS (is that Python? C++?) and I cannot understand how to select those rows.
Best Answer
Try:
In QGIS, double quotes
"
are used to reference a field. Single quotes'
are used to contain a string. No quotes for numerical values. The$
sign is used to reference a current features value, like$currentfeature
,$id
or$geometry
. The things you can use with$
are predefined.To filter for multiple values in the same field you should use
OR
rather thanAND
. This is because one field cannot contain two different values at the same time andAND
therefore will never becomeTrue
. An easier syntax than severalOR
s is to useIN
like:The coding language of QGIS expressions is similar, but not identical to SQL.