Using pulldata() to populate select_one autocomplete

162
3
08-24-2020 07:57 AM
Todd
by
New Contributor III

Is there a proper way to use pulldata() to populate a select_one type with autocomplete appearance?

Workflow is a schools.csv file with the 'state' and 'school'. Cascading select.

Thanks,
Todd
0 Kudos
3 Replies
Philip-Wilson
Esri Frequent Contributor

Hi Todd,

Yes, you can use pulldata() to populate a select one question (with or without autocomplete appearance).

This can be done in a few ways, depending on where you are getting the values from to pass into the pulldata() expression, and then return a value back into the calculation of the select one question. So is the user entering those values, or are they coming from another calculation?

Here is a quick example, when I type in the state of "VIC" into the text field, the pulldata() will calculate the value of "Melbourne" into the select one with autocomplete. Is this what you are trying to do?

Regards,

Phil.

0 Kudos
Todd
by
New Contributor III

Thanks Philip. The goal is to have a dropdown of school names based on state selected.

I currently have a working cascade using a list where I'm filtering the schools based on state selected. However, I want to move away from the dependence on the Excel file to a .csv file with additional attributes (if possible). I'm generating this .csv file using external files and software and it's very easy to update.

I have a 'schools.csv' in the media folder with NAME,STATE... schema. For testing purposes, I have a text type named 'test_state' that holds the value of state (ex: 'FL', in lieu of a choice filter) but my second control, with autocomplete appearance, only pulls in the first school name (however correctly filtered using 'FL') from my external .csv.

pulldata('schools','NAME','STATE', ${test_state})

Do I have to add a list named 'state' in the choices tab (adding all 50 states) in order to take advantage of the external .csv to populate the autocomplete?

..... I may have found additional help info here

Thanks,
Todd
0 Kudos
Philip-Wilson
Esri Frequent Contributor

Hi Todd,

I don't think you want to be using pulldata() for the workflow you are trying achieve. pulldata() can only return one value for the first match it finds in the csv.

If you want to have a cascading dropdown list that is limited based on previous choice, you need to use a choice list filter in the xlsform and have the choices in the choices sheet or an external choices list sheet in the xlsform file.

For more information see: Cascading and external selects—ArcGIS Survey123 | Documentation  and https://community.esri.com/groups/survey123/blog/2015/10/22/cascading-selects-and-external-selects 

In the upcoming 3.11 release (due out in beta soon on Early Adopter Community) we will also be including support for select one and select multiple from file (not just from choices or external choices sheet). This may help with your workflow once it is available.

Regards,

Phil.

0 Kudos