I have a table with a row Page_Number_N some of the rows have values and others just have a space. For example record 4 is just a space. Field values are Strings.



When I start an edit session and delete the space it deletes it. However, as soon as I save edits, the space in the data returns.

I have tried removing the space in the field calc without edit session turned on and the result is the same.

I need this record to equal "" ie. No spaces or null and I can't seem to get ArcGIS Desktop to cooperate.

Does anyone know how to fix this?

  • NVM FOUND OUT WHY IT NOT WORKING. Shapefiles have serious problems with attributes. For example, they cannot store null values, they round up numbers, they have poor support for Unicode character strings, they do not allow field names longer than 10 characters, and they cannot store both a date and time in a field. In short NULL values are not allowed in shapefiles. – Tristan Forward Jun 23 '13 at 16:56
  • 1
    Why does the record have to equal an empty string? If for whatever reason it must, import your shapefile to a geodatabase. – Paul Jun 23 '13 at 17:41
  • It needs to be empty because on data driven pages adjacent pages where displayed as "See Page " when they should be showing up as "[empty]" so they don't appear when printing. – Tristan Forward Jun 23 '13 at 18:34
  • how can I make field on my table reject blank space during and after editing? – user33133 Jul 3 '14 at 12:15
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. – Martin Jul 3 '14 at 13:15

Unfortunately, as you commented above, shapefiles do not support NULL values which is documented in the ArcGIS Desktop Help.

Until, your question I had not noticed that the blank space (" ") in a text field of a shapefile could not be replaced by nothing ("") but I tested and can confirm that.

If you have this requirement it represents another reason for using file geodatabases rather than shapefiles with ArcGIS for Desktop. Fortunately, the conversion is simple.

  • Well I don't think that documentation clearly states inability to store 0 length strings in a shapefile table. NULL and empty string are very different things. To me at least – FelixIP Mar 31 '16 at 2:44
  • @FelixIP NULL and empty string are very different things to me too but I think we are still up against a limitation of the shapefile format that, with them having been superseded by file geodatabases long ago, I cannot see being lifted. – PolyGeo Mar 31 '16 at 2:52

While a blank space cannot be replaced with an empty string in ArcMap, that does not mean a shapefile's text field cannot contain an empty string. You just need to do the replacement with a different DBF editor. See Which character encoding is used by the DBF file in shapefiles? which suggests OpenOffice (or LibreOffice) Calc. I used LibreOffice to fix this problem.

Note that an attribute select = " " (space) will ALSO select "" (empty string). To get the empty string only, you need to use CHAR_LENGTH(field) = 0. To get the space only, you need to use CHAR_LENGTH(field)=1 AND field = " ".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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