In ArcObjects I would use Geodatabase.IDataStatistics to get stats on a field. Does anyone know if an equivalent exists in ArcPro SDK??
Thanks,
I have looked this over more carefully now and have worked around this as much as I think I need to. I am just using it to get a unique list of values, so in case anyone else is trying to do that or anyone has any further insights that they would be able to share, this is what I have concluded so far:
It is not surprising that I was unable to use Rich Ruh’s code snippet with XY Event Layers since in the Pro GUI you cannot run the “Summarize Statistics'' tool on fields in these layers. You get an error message about there being no OID field.
You can run the “Summarize Statistics” tool on a field in a layer with a joined table. However, for using the code snippet, FeatureClass.GetDefinition() and Table.GetDefinition() are expected to throw an exception if called when there is a table join. This can be found in the API documentation here:
https://pro.arcgis.com/en/pro-app/latest/3.2/api-reference/topic7713.html
https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic7014.html
So it seems that this is a known limitation and there is a reasonable sounding explanation provided for it, but since “Summarize Statistics” can be done through the Pro GUI when there is a joined table, it is surprising that we cannot do this using the SDK too.
To be clear, in my code, I start with a BasicFeatureLayer, get a Table from it with GetTable() and then use Table.GetDefinition().
The thing that initially confused me was that Table.GetDefinition() didn’t throw an exception when the data source of the BasicFeatureLayer was a FGDB feature class and it was joined with a table within that same FGDB.
For now, I want to allow users the opportunity to use my addin in the above mentioned FGDB joined table case (or any case that Table.GetDefinition() happens to work), so I decided to do something like this at the beginning when getting the TableDefinition:
Table table = myBasicFeatureLayer.GetTable(); TableDefinition tableDefinition; try { tableDefinition = table.GetDefinition(); } catch (Exception e) { if (table.IsJoinedTable()) { ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Won't work with join…"); } else { MessageBox.Show("Please contact GIS staff…" + e.ToString()); } return; }
Thanks @RichRuh . It has been a while since I looked at this (was interrupted by other priorities). I will probably contact tech support as you suggest.
@DaveFullerton No changes here.
I'm not familiar with the CIM*** classes, but if you have a reproducible case you can share with tech support, they can send it to us for investigation.
--Rich
@RichRuh @KoryKramer @ColinZwicker
Repeating this question and tagging you guys in case you didn't see it before.
Did Esri ever provide a more obvious way to do this in the API, Rich? I am running into some issues with this not working so well, for example, with type CIMXYEventDataConnection and when CIMSqlQueryDataConnection becomes CIMRelQueryTableDataConnection via joining to a local table (it does work with a join when the data are all in the file geodatabase).
Thanks Colin, yes please confirm if unique vals can be retrieved
Cheers
Good timing
With the release of 2.2 check out:
ProConcepts Geodatabase · Esri/arcgis-pro-sdk Wiki · GitHub
Edit: totally missed your unique value statement, let me check with the team.
Colin
Hi Colin any word on when this might be exposed? Could do with an easy way of getting unique values from a field.
Hi Colin,
We are using UniqueValues, min, max. Please accelerate exposing of this functionality
Just simple stats is all I am looking for.
Thanks!
Brian,
ArcGIS Pro Core.Data has not exposed this functionality yet. We will look to do so in a future release.
Do you utilize the simple stats (count, min\max etc) or standard deviation?
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.