Geethaka Fernando Joel Meier Johnathan Hasthorpe
As of version 3.1, we can use the jr:choice-name function.
- jr:choice-name: This function takes a choice list value as an input and returns its label. The syntax goes as follows:
jr:choice-name(${activity},'${activity}')
The first parameter represents the choice name. In the example above, I am passing the choice name selected in the 'activity' question. The second parameter is the question in the form using the list where the choice has been made. Very often, the first and second parameters will reference the same question, but note that the second parameter is enclosed with quotes, because it does not refer to the value (response) of the question, but to the actual question itself.
This is a very handy function in a handful of scenarios. For example, when you want to pass the label of a choice into a webhook, when you want to store a selection in a feature layer using the label or when you want to use the choice label in a note.
You can use this function in a calculate or hidden question. The label stored in your calculate or hidden question will be part of the payload of your webhook.
I thought some of this would be cool to have documented in a more formal way, so I published a post with some details: https://community.esri.com/groups/survey123/blog/2018/12/02/survey123-tricks-of-the-trade-xlsform-fu...