Dynamic choice lists from feature service with too many records

1396
2
Jump to solution
02-11-2022 08:56 AM
Jay_Gregory
Occasional Contributor III

I have been working through the information located @ https://community.esri.com/t5/arcgis-survey123-blog/dynamic-choice-lists-using-search-appearance/bc-... to develop a survey that is pulling information from a feature service for a choice list (select_one with autocomplete search appearance where you are searching a feature service url).  But I'm running into an issue: the survey performs a single query and pre-populates the list.  If your feature service doesn't return the value you're looking for in a single query then you are out of luck.  You can always change the max record results returned, either in the service itself or apparently in the way you structure the appearance cell of the XLSX, but what if your feature service contains 500k records or more?   This is not a good solution. 

Seemingly, how it should work, is when you are typing into the select_one text box, it should perform a dynamic query (where=fieldname LIKE '%{inputtext}%') to retrieve a smaller list of results, similar to how the search widget in the JavaScript works.  After the 3rd character, the search widget just starts querying the REST endpoint after each character, resulting in an ever-narrowing down list of results that match your text input.  

Does anyone have any ideas on how to get this to work for much larger number of records?

0 Kudos
1 Solution

Accepted Solutions
ZacharySutherby
Esri Regular Contributor

Hello @Jay_Gregory

Unfortunately search() does not page through the results to a query, we do have an issue in our backlog to support this functionality. 

Our current recommendations would be to either:
- Use the query statement to pre-filter the results if that's possible

- Or as you mentioned increase the maxRecordCount for the feature service 

Thank you,
Zach

View solution in original post

0 Kudos
2 Replies
ZacharySutherby
Esri Regular Contributor

Hello @Jay_Gregory

Unfortunately search() does not page through the results to a query, we do have an issue in our backlog to support this functionality. 

Our current recommendations would be to either:
- Use the query statement to pre-filter the results if that's possible

- Or as you mentioned increase the maxRecordCount for the feature service 

Thank you,
Zach
0 Kudos
Jay_Gregory
Occasional Contributor III

Instead of paging, I would suggest using the same pattern that the Search Widget in the JS API follows.  I think it just submits a succession of async LIKE queries which narrows down the list.  No need to prepopulate the choice set from every record - just wait until the user starts typing.  

0 Kudos