Bug report #15771

@parent not linked to the correct feature when looping through layer

Added by Mathieu Pellerin - nIRV about 8 years ago. Updated about 8 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:Matthias Kuhn
Category:Expressions
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:23693

Description

While testing out the cool new @parent variable for the aggregate() function, I noticed the @parent variable doesn't get assigned to the correct feature when looping through a layer (as part of labelling or symbology rendering). I've attached a small test project which demonstrate the issue.

Steps to reproduce
  1. Open the parent.qgs test project
  2. Take note of the label over the two orange areas
  3. It should be showing the number of overlapping points, which it does properly only for the first feature (i.e. 3), while the second feature also shows 3 when it should show 2.
  4. The labels' second line show the @parent COMM_CODE value, which shows the wrong one for the second feature (it should be 123456, and instead it prints 12345)

parent.zip (6.93 KB) Mathieu Pellerin - nIRV, 2016-10-27 09:25 PM

parent_v2.zip (7.16 KB) Mathieu Pellerin - nIRV, 2016-10-30 06:37 PM

Associated revisions

Revision e7333f68
Added by Matthias Kuhn about 8 years ago

[ogr] Ignore request limit if unable to compile expression

Fix #15771

Revision 5e3bef77
Added by Nyall Dawson about 8 years ago

Fix QgsFeatureRequest with expression not using provider fields
and limit (fix #15771)

Revision cfeeb3fd
Added by Nyall Dawson about 8 years ago

Fix QgsFeatureRequest with expression not using provider fields
and limit (fix #15771)

(cherry-picked from 5e3bef7)

History

#1 Updated by Mathieu Pellerin - nIRV about 8 years ago

This commit (#7a05a7a8c4b9184f6cad7d155b6714076b1dccd9) improved things (i.e. @parent's caching works, so is $geometry's), but caching is still not updated for "fields" in the filter clause.

I'm attaching an updated test project, which labels two polygons using three aggregate calls, the third one being built on a "field" = attribute(@parent,"parent_field) which fails for the 2nd polygon. The failure is due to "field" not being updated with the 2nd polygon's values.

#2 Updated by Anonymous about 8 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF