49

How do I identify which features have NULL attributes in the attribute table of a shapefile?

When i try [field]= 'NULL' it selects the features with value = 0 (see picture)

example

Taras
  • 32,823
  • 4
  • 66
  • 137
vascobnunes
  • 5,570
  • 13
  • 49
  • 74

4 Answers4

88

Try replacing the "=" with "is".

I don't have QGIS in front of me, but that is pretty common database select syntax for working with NULL values.

pedonal is NULL
PolyGeo
  • 65,136
  • 29
  • 109
  • 338
RyanKDalton
  • 23,068
  • 17
  • 110
  • 178
2

The field name is "ASSETID", it is either a value or NULL. But actually the field was a text field (KML). I tried..

"ASSETID" ISNULL, "ASSETID" IS NULL, ISNULL("ASSETID"), "ASSETID" = ""  NOTHING WORKED!

However

"ASSETID" = '', "ASSETID" IN ('') did work also for search "ASSETID" in ('2251', '4321' etc)

Archaic but workable.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
John Groat
  • 21
  • 1
  • Whilst this works, I think QGIS needs to improve this somehow - The expression documentation specifically states "To test for NULL use an IS NULL or IS NOT NULL expression." – nr_aus Oct 07 '21 at 02:35
2

Instead of "Null",

Try:

[FieldName] IS None
PolyGeo
  • 65,136
  • 29
  • 109
  • 338
geopino
  • 21
  • 1
2

To select NULL values, click your field. then type in "is NULL." It should look like this: "Field" is NULL. No apostrophe mark (') around the word NULL. Apostrophes are needed around the defined values.