Select_one_external empty on items.csv update

191
3
12-14-2018 11:51 AM
Highlighted
New Contributor

Testing this against S123 Connect 3.1.1.126. I have a need to update the options of a select_one question with new data on a daily interval. The data in this select_one doesn't have any need for a choice filter, it's only a hundred or so items with distinct, well known names and an autocomplete appearance for the question will suffice.

Since the documentation specifies a select_one_external must have a choice filter I've taken a round about approach for creating a hidden question with a default value to use as the choice filter.

When I open the survey in Survey123 Connect, the dropdown for the question works normally.

However, if I go into itemsets.csv in the media folder and make any modification to the csv, such as deleting a row, the dropdown breaks (I leave the csv open on refresh so it won't be overwritten by Connect on refresh).

The same behavior occurs if the survey is published and I update the survey media folder in python as ESRI described in how to update the media folder.

I've tried a couple different modifications to no success:

  • Default or calculation on hidden question
  • Different data types, e.g. string vs int
  • Changing hidden question to a normal question with the value stored in the feature service

I also tested with a normal cascading select and the issue does not occur, seems like it's a problem with the choice filter on a question with a default/calculation.

Is this a bug or is there another approach I could take to get the options update (without having to manually republish the survey through S123 Connect)? I'd prefer not to dig through S123 connect to figure out how to publish programmatically, since updating the media folder is pretty easy/straightforward with code out there to use.

Reply
0 Kudos
3 Replies
Highlighted
New Contributor

Update on this question. Adding a hidden question to serve as a placeholder for filtering a select_one_external is the right approach; however, there are some pitfalls that can occur when updating the itemsets.csv which  will cause the select_one_external dropdown to not load. This is only occurring in the native application, no issues on the web app. To inspect how the csv is storing the values, use a text editor instead of excel. Here are two options for getting the filter to work:

  1. Quote all non-numeric columns in itemsets.csv. When modifying the data from excel and saving as a csv or by doing it programmatically with python, the default export settings does not wrap quotes around data elements. When Survey123 connect exports the itemsets.csv it wraps the _EXTERNAL data elements as _” but when modified from excel or python the value ends up as unquoted. This can easily have modified and solve the issue as follows:

 

WRONG (QUOTE NONE):

list_name,name,label,_EXTERNAL

facility,2.0,ABINGDON AREA HEADQUARTERS AND SHOP,_

facility,85.0,ABINGDON RESIDENCY COMPLEX,_

facility,111.0,ACCOMAC RESIDENCY COMPLEX,_

 

CORRECT (QUOTE ALL):

"list_name","name","label","_EXTERNAL"

"facility","2.0","ABINGDON AREA HEADQUARTERS AND SHOP","_"

"facility","85.0","ABINGDON RESIDENCY COMPLEX","_"

"facility","111.0","ACCOMAC RESIDENCY COMPLEX","_"

 

CORRECT (QUOTE NON-NUMERIC):

"list_name","name","label","_EXTERNAL"

"facility",2.0,"ABINGDON AREA HEADQUARTERS AND SHOP","_"

"facility",85.0,"ABINGDON RESIDENCY COMPLEX","_"

"facility",111.0,"ACCOMAC RESIDENCY COMPLEX","_"

 

 

  1. Quote nothing, but include an additional column following the choice filter or move the choice filter so it is not in the last position:


WRONG (CHOICE FILTER IN LAST POSITION):

name,facility,label,list_name,image,label::language1,_EXTERNAL

1.0,,ACCOMAC RESIDENCY COMPLEX,facility,,,_

2.0,,AIRPORT AREA HEADQUARTERS,facility,,,_

3.0,,AMISSVILLE STORAGE AREA,facility,,,_

 

CORRECT (CHOICE FILTER NOT IN LAST POSITION):

name,facility,label,list_name,image,label::language1,_EXTERNAL,EMPTY

1.0,,ACCOMAC RESIDENCY COMPLEX,facility,,,_,

2.0,,AIRPORT AREA HEADQUARTERS,facility,,,_,

3.0,,AMISSVILLE STORAGE AREA,facility,,,_,

 

 

CORRECT (CHOICE FILTER NOT IN LAST POSITION):

name,facility,label,list_name, ,_EXTERNAL,image,label::language1

1.0,,ACCOMAC RESIDENCY COMPLEX,facility,_,,

2.0,,AIRPORT AREA HEADQUARTERS,facility,_,,

Highlighted
Esri Frequent Contributor

Hi Brian,

Yes you are correct, the field app is expecting that all values in the external csv file be wrapped in quotations marks, the same as when the file is created publishing from Connect. The web app may still be able to load the external csv without quotations, however the field app cannot. Further information on this can be found here:

https://community.esri.com/groups/survey123/blog/2017/12/08/an-alternative-way-to-update-the-media-f... 

Phil.

Highlighted
New Contributor II

Hi Philip,

I am using your "update media folder" script as referenced above.

Works great. Thank you.

Thank you also Brian - very helpful.

Regards

Rudolf