[mapguide-users] How to select expression with the FDOproviderforSDF

Bruno Scott Bruno at geomapgis.com
Wed Feb 7 05:43:10 EST 2007


Thanks a lot Greg

It works fine.

With only one detail

queryPropertyName = FdoComputedIdentifier::Create(L"AMOUNT", L"AREA * LAND_VALUE"); 

does not work directly

I used

queryPropertyName = FdoComputedIdentifier::Create(L"AMOUNT", FdoExpression::Parse(L"AREA * LAND_VALUE")); 

 

From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Greg Boone
Sent: mardi 6 février 2007 19:32
To: MapGuide Users Mail List
Subject: RE: [mapguide-users] How to select expression with the FDOproviderforSDF

 

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/20070207/41bd3a01/attachment-0001.html


More information about the mapguide-users mailing list