[mapguide-users] How to select expression with the FDO
providerforSDF
Greg Boone
greg.boone at autodesk.com
Tue Feb 6 13:31:48 EST 2007
Actually, after consulting with other team members, you can achieve the
expected results using the FdoISelect command.
You need to use a computed identifier; try replace the
"FdoIdentifier::Create("AREA * LAND_VALUE");" with
FdoComputedIdentifier::Create(L"AMOUNT",L"AREA * LAND_VALUE");
FdoPtr<FdoISelect> sampleSelect;
FdoPtr<FdoIFeatureReader> sampleFeatureReader;
FdoPtr<FdoIdentifier> queryPropertyName;
sampleSelect =
(FdoISelect*)m_connection->CreateCommand(FdoCommandType_Select);
sampleSelect->SetFeatureClassName("Parcels");
FdoPtr<FdoIdentifierCollection> propertyCollection =
sampleSelect->GetPropertyNames();
queryPropertyName = FdoComputedIdentifier::Create(L"AMOUNT", L"AREA *
LAND_VALUE");
propertyCollection->Add(queryPropertyName);
sampleFeatureReader = sampleSelect->Execute();
while (sampleFeatureReader->ReadNext() )
{
printf("(AREA * LAND_VALUE) = %ls\n",
sampleFeatureReader->GetString(L"AMOUNT") );
}
_____
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Greg Boone
Sent: Tuesday, February 06, 2007 10:09 AM
To: MapGuide Users Mail List
Subject: RE: [mapguide-users] How to select expression with the FDO
providerforSDF
I believe you need to use the FDO SelectAggregates command as generally
outlined below....
FdoPtr<FdoIDataReader> myDataReader;
FdoPtr<FdoISelectAggregates> selCmdAggreg;
selCmdAggreg = (FdoISelectAggregates*)mConnection->CreateCommand(
FdoCommandType_SelectAggregates );
selCmdAggreg->SetFeatureClassName(L"ClassA");
FdoPtr<FdoComputedIdentifier> cmpId =
(FdoComputedIdentifier*)FdoExpression::Parse(L"(PropertyA*PropertyB) AS
FunctionA");
FdoPtr<FdoIdentifierCollection> idCol =
selCmdAggreg->GetPropertyNames();
idCol->Add( cmpId );
myDataReader = selCmdAggreg->Execute();
while ( myDataReader->ReadNext() )
{
printf("(PropertyA*PropertyB) = %ls\n",
myDataReader->GetString(L"FunctionA") );
}
-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Bruno Scott
Sent: Tuesday, February 06, 2007 5:50 AM
To: mapguide-users at lists.osgeo.org
Subject: [mapguide-users] How to select expression with the FDO provider
forSDF
I'm trying to select expression using the FDO provider for SDF but it
always
return me errors
This is my sample code
FdoPtr<FdoISelect> sampleSelect;
FdoPtr<FdoIFeatureReader> sampleFeatureReader;
FdoPtr<FdoIdentifier> queryPropertyName;
sampleSelect = (FdoISelect
*)m_connection->CreateCommand(FdoCommandType_Select);
sampleSelect->SetFeatureClassName("Parcels");
FdoPtr<FdoIdentifierCollection> propertyCollection =
sampleSelect->GetPropertyNames();
queryPropertyName = FdoIdentifier::Create("AREA * LAND_VALUE");
propertyCollection->Add(queryPropertyName);
sampleFeatureReader = sampleSelect->Execute();
What am i doing wrong?
Thanks
Bruno Scott
--
View this message in context:
http://www.nabble.com/How-to-select-expression-with-the-FDO-provider-for
-SDF-tf3179976s16610.html#a8823998
Sent from the MapGuide Users mailing list archive at Nabble.com.
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20070206/8d18a9ad/attachment-0001.html
More information about the mapguide-users
mailing list