QueryFeatures to return all records

429
4
Jump to solution
05-19-2023 08:54 AM
Jay_Gregory
Occasional Contributor III

As a developer implementing a queryFeatures workflow for a feature layer that has not been added to the view, if a query would end up exceeding the max number of features allowed by the service, is it the responsibility of the developer to make subsequent queryFeatures calls to capture all features?  That is, does the developer has to write the logic to to look at the "exceededTransferLimit" return value, and make subsquent calls implementing paging?  Is there any way to have the SDK to this for you with one function call in the code resulting in however many network calls to get the full list of features?  I know that's how it works when you're adding a feature layer to a map - you only have to write map.add(featureLayer) and the SDK just makes however many necessary calls it takes to get the features back.  Was hoping this is how queryFeatures works as well, but my preliminary testing seems to indicate that is not the case. 

Here is a codepen that shows what I'm talking about:

https://codepen.io/jaysgregory/pen/dyeKYYy

 

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

Yes it is the responsibility of the develop to make subsequent queryFeatures call with pagination. Please take a look at this sample for this: https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-query-pagination/

View solution in original post

0 Kudos
4 Replies
UndralBatsukh
Esri Regular Contributor

Hi there, 

Yes it is the responsibility of the develop to make subsequent queryFeatures call with pagination. Please take a look at this sample for this: https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-query-pagination/

0 Kudos
Jay_Gregory
Occasional Contributor III

Thanks - also seems like if you can get your results in 5 queries or fewer using query.maxRecordCountFactor could also help here.  Will that paging work with spatial queries as well?  I don't know how "ordering" works when implementing spatial queries. 

0 Kudos
UndralBatsukh
Esri Regular Contributor

Thanks - also seems like if you can get your results in 5 queries or fewer using query.maxRecordCountFactor could also help here. 

Yes you can. But that is not the main point of the sample. 

https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#orderByFi... - just orders the results of your query based on a field specified. It will work with any query.

 

0 Kudos
Jay_Gregory
Occasional Contributor III

Certainly, and thank you.  Just brainstorming different solutions here.  The paging example is great.  

0 Kudos