[GIS] Finding the “bad value” in text file row

arcgis-10.2arcgis-desktop

I have a text file that I am trying to bring into ArcMap to convert to a shapefile. I am familiar with the process of bringing in the text file and then using the "Display XY Data" tool and exporting to a shapefile.

The problem I am running into is that only part of my data will display. The first 11 records appear but the ones past that point do not. When I try to view the attribute table, I get an error message that says "There was an error loading records. The row contains a bad value [OIDTable11]. The row contains a bad value. [Field 5]".

I can't see any difference between the rows that appear and the row that apparently contains a bad value. I was hoping that someone could help me find the "bad value" so that my table will import in its entirety.

Here is a screenshot showing my original text file and the rows that display in ArcMap:
enter image description here

Best Answer

It has to do with the " representing inches, but interpreted as a quotation surrounding a string. The clue is in the records it imported. It did not import the records with ID numbers 252, 299, 301 and 306. Why, because these records are enclosed between quotation marks on the end of the line above them and at or toward the end of them. Line 249 is the first line with a quotation mark at the end, which is why it first affects record 252. Those records that did not come in all actually are within Field 5, but hidden due to the return character of the row above them being included in the string, so that Field 5 contain 2 lines (one visible the other hidden).

The line containing ID 1087 fails, because it is the next line that ends with a quote that would begin a string value, but the lines below it have no end quote to make the string stop. So it fails, because the string it builds is more than the 255 characters allowed in Field 5.

Anyway, you need to replace all quotation marks with another character like "~". Then use a field calculation to replace all "~" characters with """" (the VB way to create a quote character literal in a string).