How to run QueryFilter.Subfields using 'MIN()' and 'AS()' function in FGDB

313
3
06-10-2022 04:01 AM
by Anonymous User
Not applicable

Hi,

After connecting to the FGDB database in ArcGIS Pro SDK, I attempted to run the QueryFilter. I believe the error is due to the subfields, however I'm not sure if this is the correct method to write QueryFilter.Subfileds in the FGDB database.  I've included the code below.

Error message - "A column was provided that does not exist,"  

Could someone please help me out with this?

ShabinaBano_0-1654857984967.png

-----------code---------------------------

var featureClassAsSubEvtTableName = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(rootFolder))).OpenDataset<Table>((tableName));

QueryFilter queryFilterSubEvtSelected = new QueryFilter();
queryFilterSubEvtSelected.SubFields = $"{selectedColumnsForWhereClause}, MIN({fromMeasure}) AS {fromMeasure}";
queryFilterSubEvtSelected.WhereClause = $"LOWER({routeId}) = LOWER('{selectedLineId}')";
queryFilterSubEvtSelected.PostfixClause = $"group by {selectedColumnsForWhereClause}";

using (RowCursor rowCursorSubEvtMeasure = featureClassAsSubEvtTableName.Search(queryFilterSubEvtSelected, false))
{
//code here
}

----------------------------------------------------------------------------------

Thanks in Advance!

0 Kudos
3 Replies
RichRuh
Esri Regular Contributor

Hi Shabina,

Table.Search doesn't support functions such as "Min()". Check out the Table.CalculateStatistics method instead.

API class reference

Conceptual doc

I hope this helps,

--Rich

0 Kudos
by Anonymous User
Not applicable

Hi @RichRuh 

I would be really helpful if you could share some code snippet for the same.

 

Thanks

0 Kudos
RichRuh
Esri Regular Contributor
0 Kudos