TransWikia.com

Why blank values in attribute table don't work as NULL in QGIS?

Geographic Information Systems Asked by S. King on July 21, 2021

In QGIS 3.4 I have a layer generated from the QuickOSM Plugin with various pieces of OSM data.

enter image description here

For lines 17-19 which do not have a value in the "name" attribute, I don’t know why null isn’t showing up. I would like to select all the rows that have the name value empty. I tried using name is null, but that did not select anything. In settings, I have the option selected to say null in any blank values. My only guess is that maybe these values somehow are not empty, but they seem to be blank and I have tried writing something and then deleting it.

So what I would like to know is how I would select all rows of the table that don’t have a value in the name column. Also, if someone could explain why NULL isn’t showing up in the values that would be helpful.

One Answer

NULL is not equal to an empty string. NULL is by definition an "unknown value" of which we cannot assume anything. Whereas an empty string is a string without contents. You can test for NULL by using "column_name" IS NULL and for an empty string by using "column_name" = ''

Apparently in your data there are no NULL values but only empty strings.

What you can do is

  • Replace every empty string with NULL by using the field calculator with the expression NULLIF("name", '') (QGIS >= 3.6 required)
  • Use "name"= '' as selection criteria

Correct answer by Matthias Kuhn on July 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP