Select to view content in your preferred language

VB.Net ITableSort and QueryFilter SubFields

784
1
10-11-2012 01:28 PM
RichardFairhurst
MVP Alum
ESRI is promoting the use of Subfields on queries to limit the number of fields read by a search cursor to reduce the processing time involved in retrieving data through a cursor.

I just wanted to let others know that I have found a gotcha in VB.NET (VS 2010 with ArcGIS Desktop 10.0) when using the QueryFilter Subfields property in combination with an ITableSort interface.  If the ITableSort's QueryFilter property is set to a QueryFilter that has Subfields specified, the Sort will not return any Rows.  This occurs even if the Subfields list of the QueryFilter is identical to the list that is assigned to the Fields property of the TableSort.  The same behavior occurs when the Cursor that is assigned to the TableSort's Cursor property was originally generated using a QueryFilter that had Subfields specified.

The help for the ITableSort interface says:

"If the IQueryFilter.Subfields property is set, it is ignored as the ITableSort.Fields property always takes precedence."

But based on what I have seen that is apparently not the case, since the only way I have been able to get Rows returned from the ITableSort was to set the input QueryFilter SubFields property to "".
0 Kudos
1 Reply
sapnas
by
Frequent Contributor
I had experienced some performance and memory issues with ITableSort in the past. I normally use IQueryDef.PostFixClause to include "orderby" clause in the database query rather than using ITableSort . You can even specify the Subfields in IQueryDef. It can be used with ArcSDE, Personal and File Geodatabase data sources.
0 Kudos