48

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

0

4 Answers 4

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
2

Instead of "Null",

Try:

[FieldName] IS None
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.

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.

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
    Commented Oct 7, 2021 at 2:35

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