AnsweredAssumed Answered

Using OrderByFields with ReturnIdsOnly

Question asked by tj.rockefeller on Jul 30, 2015
Latest reply on Jul 31, 2015 by tj.rockefeller

I have some ArcGIS services hosted on a 10.1 server with a large number of records (100,000+). We are displaying an attribute table for these records in a silverlight 4 application, and to manage the volume of records we are paging the data. We use ReturnIdsOnly to get a list of objectIDs for the viewable extent, but then we only get full records for something like 100 records at a time to display in the attribute table, and these records are retrieved based on a subset of objectIDs from the objectIDs list that we got earlier using ReturnIdsOnly. Now we want to be able to sort our attribute table based on a given field either ascending or descending. To do this, I've tried using OrderByFields with ReturnIdsOnly to get a sorted list of objectIDs. So far it seems like nothing I try does anything. The objectIDs that are returned always come back just sorted numerically instead of being sorted by the field specified by OrderByFields.

 

I've been searching around and I have seen some information hinting at the fact that your layers have to be configured for advanced queries to use OrderByFields, but I haven't found anything that describes how to configure that setting or if the setting is done in the ArcGIS Server Manager or if it is done in ArcMap when the service is exported.

 

I'm pretty sure the format of the request is correct, but as an example this is what my query requests look like.

 

...

var queryTask = new QueryTask(SelectedLayer.Url);

var query = new Query();

query.Geometry = _map.Extent;

query.ReturnGeometry = false;

query.OrderByFields.Add(new OrderByField("Date", SortOrder.Descending));

query.ReturnIdsOnly = true;

query.ExecuteCompleted += queryTask_ExecuteCompleted;

queryTask.ExecuteAsync(query);

...

 

When ExecuteCompleted is fired I'm getting the full list of ObjectID's, but they are not sorted by "Date".

 

Any help getting things configured properly so that this will work is much appreciated.

 

***UPDATE***

I was looking at our feature layers that we are trying to query, and I have verified that supports advanced queries is false, so it seems the problem now is how do we make the layer so that supports advanced queries is true? I have been looking and have not been able to find any good documentation on the property "Supports Advanced Queries".

***UPDATE***

Outcomes