Select to view content in your preferred language

Overcoming QueryTask limit (get next 1000)

2654
1
Jump to solution
02-15-2013 12:42 PM
KenDoman
Occasional Contributor II
Since there is a limit on the maximum number of records returned from a query, if there's more records that match the query than are returned, is there a way to query out the next batch of records?

For instance, ArcGIS Server is set to return a maximum of 1000 records, but there's 8000 records that match a particular query.

1. Is there a way I can send a query to get me records 1001-2000?
2. Can I cut it down to a much smaller selection? Say I only want the top 20, and later I want the next 20, and then the next 20? Is that possible?

I know how to do it server side through SQL, but I didn't know if it's available through ArcGIS Rest services, or will be in the near future.

Thanks
0 Kudos
1 Solution

Accepted Solutions
DianaBenedict
Occasional Contributor III
Not sure if this will help you but I noticed in the following
http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#FeatureLayer/queryIds

the FeatureLayer.queryIds method will allow you to query for ObjectIds and there is no limit on the number of ObjectIds that are returned from the server.  So the way I see it, it seems like you can get an array of all the OID that satisfy your query then you can process your array based on the number of records/oids returned. Once you have "parsed your array of OID into more "manageable" chunks then you can use the query.objectIds to get your selection graphics/features via either the query task or FeatureLayer.queryFeatures by passing in your "trimmed-down" version of the OIDs of interest. Loop through you list you get your data of interest.


I  hope that makes sense.

View solution in original post

1 Reply
DianaBenedict
Occasional Contributor III
Not sure if this will help you but I noticed in the following
http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#FeatureLayer/queryIds

the FeatureLayer.queryIds method will allow you to query for ObjectIds and there is no limit on the number of ObjectIds that are returned from the server.  So the way I see it, it seems like you can get an array of all the OID that satisfy your query then you can process your array based on the number of records/oids returned. Once you have "parsed your array of OID into more "manageable" chunks then you can use the query.objectIds to get your selection graphics/features via either the query task or FeatureLayer.queryFeatures by passing in your "trimmed-down" version of the OIDs of interest. Loop through you list you get your data of interest.


I  hope that makes sense.