ArcMap - Feature visible on map but attributes not showing in attribute table

265
2
11-06-2023 07:05 PM
NigelDsouza
Occasional Contributor

Hi

I have come across an unusual behavior in arcmap and kind of hit a real roadblock.

I have a Polygon layer(A) in an mxd that has been configured from a view in SQL-Server. The aim is to programmatically add a definition query, extract the geometry and use the selectByLocation tool to query features from another layer. 

When configuring A, I selected an integer field(Pkey) as the object id field, select Finish , Apply, save and close the mxd.

NigelDsouza_1-1699320949502.png

I then reopen my mxd and apply a definition query to filter out a ERef(field from screenshot).

Now this is where I noticed the issue. After applying the definition query and hit zoom to layer I can see the feature on the map but not in the attribute table. As a result, when I use the select by location tool in my python script or even run it manually, it returns no results. 

NigelDsouza_0-1699326374815.png

 

I have tried a couple of things like selecting a combination of different fields as the pkey and that did seem to work for a while until this started to happen again. 

Some pointers on the way forward would be appreciated.

Regards

Nigel

 

 

 

0 Kudos
2 Replies
ChrisUnderwood
Esri Contributor

Hello @NigelDsouza , if you are not using an Esri ObjectID or a database Primary Key Constraint, then please double-check that the data in the Pkey field is both Unique and Not Null.

https://desktop.arcgis.com/en/arcmap/latest/manage-data/using-sql-with-gdbs/object-id.htm

NigelDsouza
Occasional Contributor

Thanks Chris. I have checked that the field set as the Primary Key is unique through the dataset.

I did manage to resolve this. The issue was in the underlying SQL view using the .STBuffer function. The solution was simply to remove the .STBuffer function from the SQL view and added it to the layer query when setting the layer's data source. I guess using SQL Geometry functions in SQL views results in ArcMap performance issues.

0 Kudos