I have created a survey for a forestry project in survey123 connect that has some semi-complicated xml and html formatting. Everything works fine in the viewer of survey123 connect, but once I publish it into AGOL the selected-at() function seems to not be working.
The goal of the question is to identify the persons top 5 choices from a large list and then rank them based on the order they selected. The solution I found to populate the label value associated with the name value was to import an identical CSV file to the list the xml is pulling from in the choices tab.
| type | name | label | calculation |
| calculate | question_desc | | pulldata('survey123_forestry', 'description', 'item', ${question3}) |
| | | | |
| calculate | q3_answer1 | names | selected-at(${question3}, 0) |
| calculate | q3_answer2 | names | selected-at(${question3}, 1) |
| calculate | q3_answer3 | names | selected-at(${question3}, 2) |
| calculate | q3_answer4 | names | selected-at(${question3}, 3) |
| calculate | q3_answer5 | names | selected-at(${question3}, 4) |
| | | | |
| note | | <h5> <font color="#00395A"> First Choice: </font> </h5> | pulldata('survey123_forestry', 'description', 'item', ${q3_answer1}) |
| note | | <h5> <font color="#00395A"> Second Choice: </font> </h5> | pulldata('survey123_forestry', 'description', 'item', ${q3_answer2}) |
| note | | <h5> <font color="#00395A"> Third Choice: </font> </h5> | pulldata('survey123_forestry', 'description', 'item', ${q3_answer3}) |
| note | | <h5> <font color="#00395A"> Fourth Choice: </font> </h5> | pulldata('survey123_forestry', 'description', 'item', ${q3_answer4}) |
| note | | <h5> <font color="#00395A"> Fifth Choice: </font> </h5> | pulldata('survey123_forestry', 'description', 'item', ${q3_answer5}) |
This works in survey123 connect perfectly, but when I publish it, the order in which the person selects the choices have no effect on the order of ranking. It automatically puts the choices in the order they exist in the csv.
Is the selected-at() function not working in the webapp? Does this function only work in the survey123 mobile app? Or does it have to do with the pulling from the csv? Would love any insight!