Bug report #11286

Incorrect evaluation of Rule-Base features

Added by Harry Clarke about 8 years ago. Updated over 4 years ago.

Affected QGIS version:2.4.0 Regression?:No
Operating System:Windows 8.1 Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:19582


The evaluation of complex Rule-Based symbols is not evaluating correctly

Add a vector layer to a map containing point data, and several fields. In the Layer Properties dialogue, under Style, change to Rule-Based. Add four rules of the form
fld_a ='AB' AND fld_b > 3 AND fld_c > 2009
fld_a ='CB' AND fld_b > 3 ADN fld_c > 2009
fld_c <= 2009 AND flb_B > 3
fld_b <= 3

Displaying the result or counting the features results in too many of symbol fld_b <= 3. No duplicates are counted.
However, if the data is added as three layers, and the query builder under the General tab is used to build expressions for fields fld_b and fld_c, the correct result is obtained

Transect_site_view.zip - Shapefile (6.28 KB) Harry Clarke, 2014-09-29 04:12 AM

QRIS-issue-11286.jpg - Screenshot of issue (132 KB) Harry Clarke, 2014-09-30 01:35 AM


#1 Updated by Harrissou Santanna about 8 years ago

Hi Harry,
can you join a sample data to help us try your issue, please?

#2 Updated by Harry Clarke about 8 years ago

Shapefile of the table view that created the problem

#3 Updated by Leyan Ouyang about 8 years ago

The shapefile field names are not the same so I am not sure exactly what you are doing, but be careful about data type, your "count" attribute is a string. However, I tried rules equivalent to what you wrote and did not get any issue, could you take a screenshot with the rules and the wrong end result?

#4 Updated by Harry Clarke about 8 years ago

The count field is a bigint, which is the type created by PostgreSQL when using the Count function. As requested screenshot showing the wrong counts for the rules used, and also view from PGAdmin showing the data type for the field count

#5 Updated by Giovanni Manghi over 5 years ago

  • Regression? set to No
  • Easy fix? set to No

#6 Updated by Harry Clarke over 4 years ago

  • Status changed from Open to Closed

This has been checked in QGIS 3.2.1 and issue seems have been resolved

#7 Updated by Giovanni Manghi over 4 years ago

  • Resolution set to fixed/implemented
  • Description updated (diff)

Also available in: Atom PDF