MapGuide API Reference
|
INT32 MgFeatureQueryOptions::AddComputedProperty | ( | CREFSTRING | aliasName, |
CREFSTRING | expression | ||
) |
Define an alias for a computed property and an expression for what is to be computed. In this SQL example, "select min(aDouble + aSingle) as minF, min(anInt16 + anInt16) as minI from featclass;", minF and minI are computed properties. Call this method for each computed property that you add.
int AddComputedProperty(string aliasName, string expression); |
int AddComputedProperty(String aliasName, String expression); |
int AddComputedProperty(string aliasName, string expression); |
aliasName | (String/string) The name of the computed property. |
expression | (String/string) The expression to be associated with the name of the computed property. |
<?php $queryOptions->AddComputedProperty("minF", "aDouble + aSingle"); $queryOptions->AddComputedProperty("minI", "anInt64 + anInt16"); $featureService->SelectFeatures($featureSrcResourceId, $featClassName, $queryOptions); $featureService->SelectFeatures($featureSrcResourceId, $featClassName, $queryOptions);
?> sqlplus> select min(aDouble + aSingle) as minF, min(anInt16 + anInt16) as minI from featclass;
using OSGeo.MapGuide; private MgFeatureQueryOptions queryOptions; private MgFeatureService featureService; private String className = "SdfFeatureClass"; // the SDF file identified by this MgResourceIdentifier exists in the repository private MgResourceIdentifier resourceId; private MgFeatureReader featureReader; resourceId = new MgResourceIdentifier("Library://PlatformApiDocTests/SdfFeatureClass.FeatureSource"); queryOptions = new MgFeatureQueryOptions(); queryOptions.AddFeatureProperty("FeatId"); queryOptions.AddFeatureProperty("aDouble"); queryOptions.AddComputedProperty("ceilADouble", "Ceil(aDouble)"); featureReader = featureService.SelectFeatures(resourceId, className, queryOptions);
MgInvalidArgumentException | if aliasName or expression is empty |