4

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.

1 Answer 1

11

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
2
  • 1
    Thank you! I used your second suggestion and it worked perfectly.
    – S. King
    Commented Jan 5, 2019 at 21:56
  • 1
    Note: the NULLIF function was a lie. It's not available in QGIS as of right now. But since christmas is not too long ago, I made sure it will be available in QGIS 3.6. Commented Jan 8, 2019 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.