Autocomplete Addresses

1234
2
04-12-2018 08:43 AM
JasonPevear
New Contributor II

I am trying to create an address field that uses autocomplete appearance. My goal is for the end user to type a few characters of the beginning part of the address and choices will appear and they will choose the appropriate address

I've been able to do this successfully with 10,000 records (addresses) when I use select_one as my type and fill out the choices tab. But when I add 30,000 records in my choices tab, the load time suffers tremendously as does the overall functionality. Is there anyway for these 30,000 records to reside in the external_choices tab or in a csv in the media folder and the Address will refer to either of those versus the choices tab?

I've seen several examples of external_choices but when I try it on my end, I get an error saying the choices tab isn't filled out correctly.  I thought the whole idea of using external choices was to avoid using the choices tab? 

I suppose I'm quite confused on how this works.  I've googled for months on how to do this but have found no examples of how this is done correctly.  Is this even possible? 

2 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Jason,

Yes, this should be possible.  One of Esri's Professional Services staff talked about this in 1K, 5K,10K ... pushing the limit on External Choices in Survey123 .

As you indicated, the key for getting this to work with the volume of addresses you have is to use an external select.  External selects depend on a cascading select architecture (see https://community.esri.com/groups/survey123/blog/2015/10/22/cascading-selects-and-external-selects and Cascading and external selects—Survey123 for ArcGIS | ArcGIS ; also the Cascading Selects sample in Survey123 connect).

A cascading select consists of at least 2 select_one questions - a first question that helps narrow down from the entire list of choices displayed in the second. The choices for the first question are listed as usual in the choices worksheet, while the second are placed in a new worksheet, labeled external_choices; to know to use these values instead of a list in the choices worksheet, the second select_one question should have the type select_one_external <listname> instead of select_one <listname>.  The external_choices worksheet will have the same headers as the choices worksheet, with the addition of a new column to define which answer from the first question will cause the choice to appear in the second. In the attached example, I'm using U.S. States and county (or equivalents) - there are ~3200 split between the 50 states + DC & PR.  The list of counties have an additional 'state' column to mark which state the county is in.  In the survey worksheet, we provide a filtering expression in the choice_filter of the second question to define the lookup.  In the attached worksheet, this is state = ${stateUS} - the value in the state column of the choice list is equal to the value of the stateUS question.  Once the state question is answered, the counties question will populate with the list of counties for that state.

When published, the values in the external_choices sheet are written to a file named itemsets.csv (in the media folder).  This reduces the total time to process the form (XML) file, which normally stores the choices in the form itself; the values are brought into the form only when the first question is answered.  https://community.esri.com/groups/survey123/blog/2017/12/08/an-alternative-way-to-update-the-media-f... describes how this can then be updated for the form outside Survey123 Connect.

In the case of street addresses, there are a couple of ways to group.  If your city/town has a quadrant system, that would be a quick way to implement.  Another method would be to use street name- select the street name and then lookup the number (or full street address if you have N/S/E/W/NE/NW/SE/SW versions of a street with the same name).

I would also advise checking the values of the addresses for commas - as I mentioned, the choices are stored in a CSV file- extra commas may break the table structure for that particular choice.

JasonPevear
New Contributor II

Thanks, James. The issue I had was that there was no need to cascade in this case, but will there will be in the future, as right now I'm running a pilot program with one district (3 total) to test how well Survey123 will function for us with regard to data collection.  I studied the form you attached, and on the choices tab, I just created one list_name item which equates to one district, rather than putting all three of them in. It's a nice little work around that seems to be working well. There is about a 2 second lag, but much better than what I was experiencing before. Thanks for getting me over the hump!

0 Kudos