Bug? ArcGIS Pro - Export Selected Features from Attribute Table returns wrong Object ID (-1)

2968
6
03-07-2017 08:42 AM
TylerSchwartz2
Occasional Contributor II

Hi,

In ArcGIS Pro (1.4.1), I am trying to export selected records from an attribute table to a csv file.  When I open the CSV file, all of the values under the Object ID field/column are showing as -1. Within ArcGIS Pro, the ObjectID attributes are showing correctly (separate ID for each feature) when viewing the attribute table.

When this same procedure is repeated in ArcMap the resulting csv file shows the correct ObjectID values, as expected...

Is this a bug or expected behavior?

Thanks

Tyler

Keeping in mind that for the attachments below, I only exported 1 record, but this phenomenon is replicated no matter how many records are exported...all of those record return a value of -1 under ObjectID when exported in Pro.

csv export for pro

csv export for arcmap

screenshot of attribute table from pro

6 Replies
JoshuaBixby
MVP Esteemed Contributor

Interesting, I just grabbed a random table from a geodatabase and exported it as both CSV and TXT, both had "-1" for all the ObjectIDs.  I tried a DBF as well, and the ObjectIDs were correctly populated.

I see the same behavior using Copy Rows in ArcGIS 10.5.  I assume you are using Copy Rows in Pro to export?

Table to Table in ArcGIS 10.5 produces the same results.  I am guessing this may be purposeful but poorly documented or undocumented.

TylerSchwartz2
Occasional Contributor II

Hi Joshua,

Thanks for your reply.

Workflow is as follows:

Pro (1.4.1):

1) Select features using Select tool 

2) Right click on feature in "Contents" , Attribute Table

3) within attribute table, click button "show selected records", top right corner of table, "export"

4) this opens "CopyRows_management" GP tool pane

5) select output location, change file suffix to .csv hit "run"

ArcMap (10.5):

1) Select feature using Select tool

2) right click feature in ToC, open attribute table

3) within attribute table, show selected records

4) click top left corner of attribute table dropdown, "export"

5) export dialogue, Export: selected records

6) save as text file .csv

I am not using Copy Rows in ArcMap as you can see from my workflow, and if Copy Rows is the issue, then how can I replicate my ArcMap workflow within Pro to get the desired results? The two workflows are almost identical, although it appears in Pro they force you to use the CopyRows GP tool in order to do this. This is a very easy and routine process in ArcMap.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Good question.  As you can see, in Pro the application is using the Copy Rows tool.  If you also use the tool in 10.5, you will get the same "-1" results.

I just checked the online documentation, and I didn't realize that Copy Rows only started supporting text output at 10.5, so using the tool to export to text appears to be fairly new functionality whether in Pro or ArcMap/ArcCatalog.  As was not able to find any documentation that states the "-1" is expected behavior.  Since the functionality is newer and the documentation doesn't describe "-1" as normal/expected, this looks like a bug.

The dialog driven exporting from ArcMap is using completely different code, obviously, to export, and there is no directly analogous way in ArcGIS Pro that I know of at the moment.  Maybe an Esri staffer can weigh in here, but it would be good to log a bug with Esri Support if you have access to do so.

EdTriplett
New Contributor II

I have had the exact same issue, only I am not selecting individual rows for export. When I Rt-Click my point feature in the ToC --> Data --> Export Table  ... I get this "-1" in the FID field in Excel.

To get around this I added a "Join_ID" and calculated the values for the FID before exporting to .csv. This seems unnecessary, but it is the only way around the problem that I have found.

 

0 Kudos
KoryKramer
Esri Community Moderator

BUG-000091451: The values of the ObjectID field for feature classes and the FID field for shapefiles change to -1 after running the Copy Rows geoprocessing tool and saving the output file with the .txt extension.

Should be fixed in the next release.  I just tested in Pro 2.1 and the .txt and .xls output maintains objectid instead of writing -1.

curtvprice
MVP Esteemed Contributor