Hi,You can use IDataStatistics interface.See the IDataStatistics Example in the Developer help. In your case, use IStatisticsResults.Minimum & IStatisticsResults.Maximum properties instead of the Mean property proposed in the code.Regards,Nir
pCursor = pTableSort.Rows Dim pQFilter As IQueryFilter pQFilter = New QueryFilter pQFilter.WhereClause = pQF Dim pData As IDataStatistics pData = New DataStatistics pData.Field = fieldname pCursor = pFeatureclass.Search(pQFilter, False) 'pCursor = pLayer pData.Cursor = pCursor
double dMax = pData.Statistics.Maximum; double dMin = pData.Statistics.Minimum;
Public Function RangeCalculator(ByVal PDF_Name As String, ByRef pFLayer As IFeatureLayer) As String Dim iMin, iMax As Integer Dim pTable As ITable Set pTable = pFLayer.FeatureClass Dim pCur As ICursor Dim pRow As IRow Dim iFEATID As Integer Dim iMAPPDFNO As Integer iFEATID = pTable.FindField("FEATID") iMAPPDFNO = pTable.FindField("MAPPDFNO") Dim pQF As IQueryFilter Set pQF = New QueryFilter pQF.WhereClause = "MAPPDFNO = '" & PDF_Name & "' AND FEATID <> ''" Set pCur = pTable.Search(pQF, False) Set pRow = pCur.NextRow iMin = CInt(Mid(pRow.value(iFEATID), 3, Len(pRow.value(iFEATID)) - 2)) iMax = CInt(Mid(pRow.value(iFEATID), 3, Len(pRow.value(iFEATID)) - 2)) Do While Not pRow Is Nothing If CInt(Mid(pRow.value(iFEATID), 3, Len(pRow.value(iFEATID)) - 2)) < iMin Then iMin = CInt(Mid(pRow.value(iFEATID), 3, Len(pRow.value(iFEATID)) - 2)) End If If CInt(Mid(pRow.value(iFEATID), 3, Len(pRow.value(iFEATID)) - 2)) > iMax Then iMax = CInt(Mid(pRow.value(iFEATID), 3, Len(pRow.value(iFEATID)) - 2)) End If Set pRow = pCur.NextRow Loop If iMin = 0 Then RangeCalculator = iMin ElseIf iMax = 0 Then RangeCalculator = iMin Else RangeCalculator = iMin & "-" & iMax End If End Function
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.