Bug report #13268

Selecting features of field name with a leading digit

Added by Gert Sterenborg over 9 years ago. Updated over 9 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:-
Affected QGIS version:2.10.1 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:21329

Description

For a python script I use [feature.id() for feature in layer.getFeatures(QgsFeatureRequest().setFilterExpression("8_1 IS NOT NULL"))] to get all feature id's that are not null. But it won't find any. While using the expression "8 IS NOT NULL" it will find the first feature starting with an 8. This problem does not occur when changing the layer name to for example A8_1, in that case the expression: "8_1 IS NOT NULL" works.

So I think this has to do something with using leading digits in field names.

History

#1 Updated by Gert Sterenborg over 9 years ago

typo:
This problem does not occur when changing the layer name to for example A8_1, in that case the expression: " A8_1 IS NOT NULL" works.

#2 Updated by Jürgen Fischer over 9 years ago

Gert Sterenborg wrote:

typo:
This problem does not occur when changing the layer name to for example A8_1, in that case the expression: " A8_1 IS NOT NULL" works.

Try quoting: "8_1" IS NOT NULL

#3 Updated by Jürgen Fischer over 9 years ago

  • Status changed from Open to Feedback

#4 Updated by Gert Sterenborg over 9 years ago

Jürgen Fischer wrote:

Gert Sterenborg wrote:

typo:
This problem does not occur when changing the layer name to for example A8_1, in that case the expression: " A8_1 IS NOT NULL" works.

Try quoting: "8_1" IS NOT NULL

You are right, '"8_1" IS NOT NULL' works

#5 Updated by Gert Sterenborg over 9 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF