MapGuide API Reference
 All Classes Functions Variables Enumerations Enumerator Friends

Use this method to restrict the values returned by a select operation to be unique.

.NET Syntax
void SelectDistinct(bool yes);
Java Syntax
void SelectDistinct(boolean yes);
PHP Syntax
void SelectDistinct(bool yes);
Parameters:
yes(boolean/bool) If true, apply the distinct operation; otherwise do not apply the distinct operation; the latter is the default.
Returns:
Returns nothing.
Example (PHP)
GroupName is a string property. Feature instances in the datastore have a GroupName property value of either 'Group1', 'Group2', or 'Group3'. To verify this fact, use the following select operation.

 <?php
 $aggregateOptions->SelectDistinct(true);
 $aggregateOptions->AddFeatureProperty("GroupName");
 $dataReader = $featureService->SelectAggregate($featureSrcResId, $className, $aggregateOptions);
 $dataReader->Close();
 ?>
 sqlplus> select distinct groupname from featclass;
Example (C#)
The feature schema contains a string property whose name is "GroupName". The value of this property for some features is "Group Name One" and for the rest "Group Name Two". The select aggregate operation with SelectDistinct set to true will select one feature from each group.

 using OSGeo.MapGuide;
 private MgFeatureAggregateOptions queryOptions;
 private MgFeatureService featureService;
 private String className = "SdfFeatureClass";
 // the SDF file identified by this MgResourceIdentifier exists in the repository
 private MgResourceIdentifier resourceId;
 private MgDataReader dataReader;

 resourceId = new MgResourceIdentifier("Library://PlatformApiDocTests/SdfFeatureClass.FeatureSource");
 queryOptions = new MgFeatureAggregateOptions();
 queryOptions.AddFeatureProperty("GroupName");
 queryOptions.SelectDistinct(true);
 dataReader = featureService.SelectAggregate(resourceId, className, queryOptions);
 dataReader.Close();