I’m configuring a default value on a shapefile layer, and I’m encountering an issue when attempting to count the number of identical features in the ‘num_etude’ field.
When I add a new feature with the same ‘num_etude’, it is either not found or always found, depending on how I set the criteria for identifying identical features.
I’m unsure about how QGIS is counting the number of features..
Here are the code snippets I’ve used:
aggregate(layer:= 'ZONE_ETUDE', aggregate:='count', expression:= "num_etude", filter:= "num_etude" is not null)
aggregate(layer:= 'ZONE_ETUDE', aggregate:='count', expression:= "num_etude", filter:= "num_etude" = coalesce("num_etude",0))
aggregate(layer:= 'ZONE_ETUDE', aggregate:='count', expression:= "num_etude", filter:= "num_etude" = "num_etude")
The result is always 1, regardless of the value I input in the ‘num_etude’ field.
I expect the value to be updated to 0 if there is no existing equivalent, 1 if there is only one, and 2 or more if there are multiple identical features.
Understanding what is going wrong here will help me resolve the entire problem. afterward.
Giene is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.