Bug report #10151
expression-based label regression, wrongly displaying NULL instead of nothing
|Affected QGIS version:||2.2.0||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||18608|
In the recent weeks, a regression has made its way to QGIS master resulting in expression-based labels labelling features with NULL when it should simply not show any label. It's a pretty significant issue.
For example, if your opening an OpenStreetMap roads dataset and only want to show labels for primary roads, the following expression was working just fine under QGIS 2.2: CASE WHEN ("highway" = 'primary') THEN "name" END
Under QGIS 2.3, applying the above expression will have all of the non-primary roads labelled NULL.
See attached project.
#2 Updated by Mathieu Pellerin - nIRV over 6 years ago
It's definitively not desirable for labels to show NULL in a negative conditional expression; beyond the fact that the needed behavior is for no labels to show, it's also misleading the users into thinking the column's value is NULL (i.e. a positive conditional expression who's resulting field is NULL).