3

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.

1
2
3

5

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?

Matt
  • 1,672
  • 16
  • 24
Tristan Forward
  • 2,199
  • 3
  • 23
  • 43
  • 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? –  Jul 03 '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 03 '14 at 13:15
  • The colleague of mine found Shapefiles do not support NULL values. DBase 7 supports NULL values; shapefiles are pre-dBase 7. ArcView 3.x uses a masking technique to present certain values as NULL, although they are not true NULL values. Shall I just remove Q?

    See http://support.esri.com/en/knowledgebase/techarticles/detail/20177

    – FelixIP Mar 30 '16 at 21:44
  • If you don't want them to appear in your DDP for printing, can you put a definition query on your DDP layer to not include records with spaces? – Fezter Mar 30 '16 at 23:29

2 Answers2

5

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.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
  • 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 02: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 02:52
1

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 = " ".