I am using survey123 to create a survey of all existing bus stops in a transit agency. I am trying to create a way for the person filling out the survey to have the bus stop ID automatically filled in when the user selects the intersection of the two streets from a menu. I have a csv with the intersection name & stop ID as the only 2 columns. As far as I can tell I have designated the field 'number' in the csv as the value i want returned, I have designated 'name' as the field in the csv used to look up the value, finally I have used 'test' as the key field from the form used to look up the data. Web link to survey is here --->https://arcg.is/0Tj4CK . The web interface throws an error in the console that says "stop code", a heading I previously used for the number column in the csv, cannot be turned into a valid xml element. I have changed this and it does not seem to have helped. Any feedback on these problems is appreciated.
Hi,
Thanks for providing your XLSForm and CSV files. It's likely the space in the "stop code" column header caused the XML error in the web app - please see comments here on a related issue and also documented here.
Looking at your XLSForm, the pulldata syntax is correct. However, select_one questions return the value from the name column on the choices sheet, not its label, so the pulldata function is trying to match the intersection name in the csv with the number from the name column on the choices sheet.
With that in mind, you could use just the select_one (without the need for a pulldata csv) by putting all the stop numbers in the name column on the choices sheet and their respective intersections in the label column. The user selects the intersection from a select_one question (e.g. 'stopnum'), and then the value (in this case the stop number in the name column) is written to another field by using ${stopnum} as the calculation.
Hope this helps, any queries please let me know.
Best regards,
Jim