Hello all,
Is there any syntax using 'jr:choice-name' for all/ any selections in multiple choices? I hope to get labels in the attributes no matter how many answers are selected. I am aware that 'at' can be used to pull out the value in the specific order, but not sure how I can apply it to the entire answers.
Hi Kerry,
Unfortunately this isn't possible using jr:choice-name(), which will only use the label to populate the attribute if one selection is made. Did you come up with a workaround or alternative to this workflow? If so, please share it on the forum.
Thanks,
Brett
Hi Brett/Kerry,
I am totally new to GIS domain. So happens I came across this website with the extensive methods to invoke within XLS for Survey123 Connect. Within the PDF there is a section describing the jr:choice() for multiple choice questions. Below is the example used to select exactly three colors:
Table 1: Survey
type | name | label | hint | constraint | constraint_message |
select_ multiple colors | color_prefs | What colors do you like? | Select three | count-selected(.)=3 | Select exactly three. |
Table 2: Choices
list_name | name | label |
colors | red | Red |
colors | blue | Blue |
colors | yellow | Yellow |
colors | green | Green |
colors | orange | Orange |
colors | purple | Purple |
Table 3: Survey with jr:choice()
type | name | label | hint | calculation |
select_multiple colors | color_prefs | What colors do you like? | Select three. | |
calculate | color_0 | jr:choice-name( selected-at(${ color_prefs}, 0), ’${color_prefs}’) | ||
calculate | color_1 | jr:choice-name( selected-at(${ color_prefs}, 1), ’${color_prefs}’) | ||
calculate | color_2 | jr:choice-name( selected-at(${ color_prefs}, 2), ’${color_prefs}’) | ||
note | color_note | Selected colors: | ${color_0} <br> ${color_1} <br> ${color_2} |
Snapshots from the PDF are attached here for your reference. Pardon for the resolution, it is snipped based on the PDF. For more information you can visit this link and download the PDF for its full information: https://docs.getodk.org/
I was able to use such concept on my form to produce the expected output.
Hopefully it helps!