Bug report #10900
python filter expression don't work on "value relation"
|Affected QGIS version:||2.18.4||Regression?:||Yes|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||worksforme|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||19265|
trying to filter the entries of a "Value relation" with the extent of the current map canvas, I get a empty list of values.
The same expression used to update a column of the table works fine...
Here is the expression I use :
intersects( $geometry , geomFromWKT( $current_canvas_extent ))
and here is the function providing $current_canvas_extent :
from qgis.utils import qgsfunction from qgis.utils import iface @qgsfunction(0, "Python") def current_canvas_extent(values, feature, parent): """ retourne l etendue courante de la carte """ extend = iface.mapCanvas().extent().asWktPolygon() return extend
It woks fine on 2.2
Thanks a lot,
#7 Updated by Mathieu Bossaert over 4 years ago
- Target version set to Version 2.16
- Status changed from Closed to Reopened
time have passed, and this worked well until QGIS 2.14.
Since 2.16, same bug appears, expression value is ok but the list stay empty.
Maybe you would have prefer that I opened a new ticket ?
Thanks a lot for your your help and the work you do on our prefered GIS tool !
#12 Updated by Matthias Kuhn over 4 years ago
- Resolution set to worksforme
- Description updated (diff)
- Status changed from Reopened to Closed
needs to be replaced with
(it's a function, not a special column)
Works perfectly fine for me like this on 2.18.
You might also be interested in reading this recent blog posts about needsGeometry and referencedColumns ;)