Hi all,
I created an Addin to summarize a field using FeatureCount() method and add the result table into a list view. the purpose of the tool is to find duplicate atttributes. The code bellow works fine but it takes about 1 minute to return the result when quering multiple features (more than 5000 features for example). I am wondering if there is a sql statement to use such as Select fieldName, Count(FieldName) from table Group by FieldName, or is there a way to call the summarize field command in ArcMap? Also, attached is a screenshot of the tool with results.Attachment 33859
I created an Addin to summarize a field using FeatureCount() method and add the result table into a list view. the purpose of the tool is to find duplicate atttributes. The code bellow works fine but it takes about 1 minute to return the result when quering multiple features (more than 5000 features for example). I am wondering if there is a sql statement to use such as Select fieldName, Count(FieldName) from table Group by FieldName, or is there a way to call the summarize field command in ArcMap? Also, attached is a screenshot of the tool with results.Attachment 33859
Code:
'define datastat to query unique values
Dim pDataStats As New DataStatisticsClass()
'define data collection
Dim pEnum As IEnumerator
pDataStats.Field = selectedFieldName
pDataStats.Cursor = fCursor
pEnum = pDataStats.UniqueValues
Dim dataStatResult As IStatisticsResults = pDataStats.Statistics
pEnum.Reset()
Do While pEnum.MoveNext
'Add unique feature in the first column
newlist = ListViewDataresult.Items.Add(pEnum.Current)
'define the whereclause
Dim whereclause As String = String.Format("{0} = '{1}'", pDataStats.Field, pEnum.Current)
Dim queryFilter As IQueryFilter = New QueryFilterClass()
queryFilter.WhereClause = whereclause
Try
'Adding the count of features in the second column
newlist.SubItems.Add(fclass.FeatureCount(queryFilter))
Catch ex As Exception
MessageBox.Show("Ooops, FieldCount Error: " & ex.Message)
End Try
Loop