Select to view content in your preferred language

Using OrderByFields with ReturnIdsOnly

2663
1
Jump to solution
07-30-2015 01:06 PM
TJRockefeller
Occasional Contributor

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***

0 Kudos
1 Solution

Accepted Solutions
TJRockefeller
Occasional Contributor

http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Dynamic_Layer_Table/02r3000000q00000...

supportsAdvancedQueries would return false in the following scenarios:

The layer / table resides in a workspace other than an enterprise database or File Geodatabase.

The layer / table is joined with another layer / table from a different workspace.

We put our shape files into a File Geodatabase, and we were able to get Supports Advanced Queries to show true, but we are still having issues with using OrderByFields, but that is a different question.

View solution in original post

0 Kudos
1 Reply
TJRockefeller
Occasional Contributor

http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Dynamic_Layer_Table/02r3000000q00000...

supportsAdvancedQueries would return false in the following scenarios:

The layer / table resides in a workspace other than an enterprise database or File Geodatabase.

The layer / table is joined with another layer / table from a different workspace.

We put our shape files into a File Geodatabase, and we were able to get Supports Advanced Queries to show true, but we are still having issues with using OrderByFields, but that is a different question.

0 Kudos