AutoCAD Map 3D 2009 Geospatial Platform Reference

AutoCAD Map 3D Geospatial Platform API

void MgFeatureAggregateOptions::SetGroupingFilter ( MgStringCollection groupByProperties,
CREFSTRING  groupFilter 
)

Modifies a select operation with a grouping filter so that the results are grouped.

Remarks:
For example, select the smallest value from a numerical property for each group of feature objects specified in the grouping filter expression. An instance of this example in SQL syntax is "select min(aDouble) as minD from featclass group by groupname having groupname = 'Group1' or groupname = 'Group2' or groupname = 'Group3';".
.NET Syntax
void SetGroupingFilter(MgStringCollection groupByProperties, string groupFilter);
Java Syntax
void SetGroupingFilter(MgStringCollection groupByProperties, String groupFilter);
PHP Syntax
void SetGroupingFilter(MgStringCollection groupByProperties, string groupFilter);

Parameters:
groupByProperties (MgStringCollection) The collection of properties to be used in the grouping filter specified in the second parameter.
groupFilter (String/string) The grouping filter expression.
Returns:
Returns nothing.
Example (PHP) GroupName is a string property, and aDouble is a double property. Three values are returned by this query. Each of them is the smallest aDouble property value in one of the groups of features selected by the grouping filter.
 <?php
 $stringCollection->Add("GroupName");
 $groupingFilter = "GroupName = 'Group1' or GroupName = 'Group2' or GroupName = 'Group3'";
 $aggregateOptions->SetGroupingFilter($stringCollection, $groupingFilter);
 $aggregateOptions->SetComputedProperty("minD", "min(aDouble)");
 $dataReader = $featureService->SelectAggregate($featureSrcResId, $featClassName, $aggregateOptions);
 ?>
 sqlplus> select min(aDouble) as minD from featclass group by groupname having groupname = 'Group1' or groupname = 'Group2' or groupname = 'Group3';

Exceptions:
MgInvalidArgumentException