Automation Exception while using the order by clause with the query filter

2037
8
06-11-2013 03:03 AM
pavan_kumarmuttigi
New Contributor
Hi,

Can any one please help me in resolving the issue with the query filter which I am getting when trying the query with order by clause.
BTW, I am working using the ArcObjects API for Java.

I am getting the following Automation Exception: Item Not Found in this Collection.

I am using the query to the queryfilter like as follows.

String query = ST_ID in (234,456) order by ST_ID asc

IQueryFilter queryFilter = new QueryFilter();
queryFilter.setWhereClause(query);

I am getting the above mentioned AutomationException.Can anyone please help me in resolving the issue?
Actually I do have a doubt like does the order by clause is supported in ArcObjects?

Thanks in Advance
0 Kudos
8 Replies
nicogis
MVP Frequent Contributor
'Order by' you need use PostfixClause



IQueryFilter queryFilter = new QueryFilterClass();
queryFilter.SubFields = "NAME, ADDRESS";
queryFilter.WhereClause = "TYPE = 'Restaurant'";
IQueryFilterDefinition queryFilterDef = (IQueryFilterDefinition)queryFilter;
queryFilterDef.PostfixClause = "ORDER BY NAME";


0 Kudos
pavan_kumarmuttigi
New Contributor
Hi Domenico Ciavarella,

I actually tried with code snippet you posted for the case of using order by clause for querfilter.
It didn't worked for me. I am getting the same automation exception as: Item  not found in this collection. in 'DAO.Fields'.
I am wondering that is order by clause  supported with file geodatabase?.Especially with ArcGIS 10.0 version.

Thanks in Advance.
0 Kudos
NeilClemmons
Regular Contributor III
The documentation for the PostfixClause property states that the property is not supported for file geodatabases.
0 Kudos
pavan_kumarmuttigi
New Contributor
Hi Neil Clemmons,

Thank You for your information on postfix clause. Is there a way like to implement the order by clause in the file geodatabase approach.Please let me know.

Thanks in Advance.
0 Kudos
NeilClemmons
Regular Contributor III
Yes, use the ITableSort interface to get a cursor sorted on the field you specify.
0 Kudos
pavan_kumarmuttigi
New Contributor
Hi Neil Clemmons,

Can you Please send me the snippet on how to use the ItableSort interface to get work the Order By clause over the File GeoDatabase approach?


Thanks in Advance.
0 Kudos
NeilClemmons
Regular Contributor III
It's in the developer help topic for the ITableSort interface.  All you have to do is look it up.
0 Kudos
pavan_kumarmuttigi
New Contributor
Hi Neil Clemmons,

Thanks for your help and support.

It helps me a lot 🙂

Thanks once again.
0 Kudos