UniqueValues In ArcGIS Pro SDK

535
2
Jump to solution
04-23-2021 02:48 PM
JayFlorey
New Contributor II

I am in the process of converting from ArcObjects SDK for .NET to the ArcGIS Pro SDK for .NET. My existing code base uses the UniqueValues property of the IDataStatistics interface to get an enumerator of unique values in a field. I have been unable to find an equivalent function in the ArcGIS Pro SDK. Is there one?

Thanks as always for any assistance.

Regards,

Jay

0 Kudos
1 Solution

Accepted Solutions
RichRuh
Esri Regular Contributor

Hi Jay,

You can do this using the statistics, although it's not as clear as I'd like it to be.

The statistics capabilities are described here.

What you will want to do is create a TableStatisticsDescription.  Set the GroupBy property to the field you want to get unique values for.  OrderBy and QueryFilter can be left blank.  For StatisticsDescriptions, you need to pass in a "dummy" function- I would suggest you just pass in the same field and "Count" as the function.

I hope this helps some.

--Rich

 

 

View solution in original post

0 Kudos
2 Replies
RichRuh
Esri Regular Contributor

Hi Jay,

You can do this using the statistics, although it's not as clear as I'd like it to be.

The statistics capabilities are described here.

What you will want to do is create a TableStatisticsDescription.  Set the GroupBy property to the field you want to get unique values for.  OrderBy and QueryFilter can be left blank.  For StatisticsDescriptions, you need to pass in a "dummy" function- I would suggest you just pass in the same field and "Count" as the function.

I hope this helps some.

--Rich

 

 

0 Kudos
GintautasKmieliauskas
Regular Contributor

Hi,

If you are using databases (not shapefile, dbf or info tables) you can use QueryFilter with DISTINCT in PrefixClause or PostfixClause. More info here:

ProConcepts Geodatabase · Esri/arcgis-pro-sdk Wiki · GitHub

0 Kudos