Select to view content in your preferred language

Added Field to Layer and now Layer doesn't work

223
6
02-18-2025 10:56 AM
JonathanHerman
Emerging Contributor

I added a field to an attribute table in ArcPro. I'm not sure if the layer was in Edit mode or not, but now the layer is apparently completely unavailable. I immediately got a message that the table couldn't be re-freshed. The layer disappeared in my map/layout view and in the Contents panel it has a exclamation mark. I cliched that to 'repair the layer's data source' and it does nothing. I tried re-importing the shapefile and I get the message 'Number of shapes does not match the number of table records'. I searched online for solutions and the only replies are that the file is now "corrupted" and basically I shouldn't have done what I did?!

I can't believe this. I click one button to add a Field by mistake and - boom - layer is corrupted and its completely irrecoverable! Really? Any help would be appreciated. 

0 Kudos
6 Replies
DanPatterson
MVP Esteemed Contributor

If you have to use shapefiles, use them as an input to Copy Features to get a featureclass in a file geodatabase, or use shapefiles as the final export.  Once the shapefile is corrupt, which can happen when doing things like you subscribe, your only option is to use your backup and start again


... sort of retired...
0 Kudos
JonathanHerman
Emerging Contributor

Could you explain at bit more about the 'option to use your backup and start again'? What is the 'backup'? When you say 'start again' it sounds like my data is not recoverable which seems crazy to me. 

Thank you for your quick response DanPatterson!

0 Kudos
DanPatterson
MVP Esteemed Contributor

Sorry, my practice is to keep a copy of all data in a safe place as a "backup"

Should something go wrong, I can start again by copying the backup and using it going forward.

It is the "you only get burned once" scenario


... sort of retired...
0 Kudos
RhettZufelt
MVP Notable Contributor

Did you use the Data Design Fields context menu or the Add Field GP Tool to add the field?

That error message almost sounds like you added a row to the table without geometry, not a new field.

R_

0 Kudos
JonathanHerman
Emerging Contributor

I used the Data Design Fields menu. I opened the Layer Attribute table. At the top of the Attribute Table menu I clicked the 'Add Field' button. Then the 'Data Design Fields' menu opened and at the bottom I added what I thought was a new field to the attribute table and saved it. I can't remember but it may have been outside of an Edit session. Anyway, now I can't even access the layer anymore and it was my only copy of the data (unless ArcPro saves a backup I don't know about?). It certainly seemed like I was adding a new Field and not a new Row because I was in the Data Design Fields menu. You can't add new rows in that menu anyway can you?? It's just mind-boggling to me that if some operation is going completely corrupt your layer why ArcPro doesn't prevent you from doing it like greying out the Add Field button.

0 Kudos
RhettZufelt
MVP Notable Contributor

Well, sounds like you added a field, not a row.  Not sure what happened as I generally avoid Shapefiles whenever possible.  I generally convert to featureclass as @DanPatterson commented above.

Depending on where it is stored, and the setting on that computer,  sometimes you can right click on the folder containing the shapefile (in windows explorer) and get properties.  If it is enabled, you will see a Previous Versions tab and can copy 'backups' from date/times available in the previous version tab.  If so, remember a shapefile is a group of files all with the same name but different extensions and you need to copy all of them for a 'valid' shapefile.

Also, have you tried the Repair Geometry GP Tool?  Sometimes this can fix issues like this.

If all else fails, though probably won't get you anywhere, I would open the shapefilename.dbf file in Excel and make sure there aren't any weird/invalid characters, values, etc. in there, and if so, remove/replace them, save the dbf, and try the shapefile again.  Of course, would only test this on a copy of the data, just in case...

R_

 

0 Kudos