I'm trying to use the jr:choice-name function in a rank question in a form in the Web App, but the result is always 'undefined'. The goal is to return the label of the first 3 choices, concatenated by commas.
concat(jr:choice-name(selected-at(${teste_rank}, 0),'${teste_rank}'), ', ', jr:choice-name(selected-at(${teste_rank}, 1),'${teste_rank}'), ', ', jr:choice-name(selected-at(${teste_rank}, 2),'${teste_rank}'))
In Connect (v. 3.20.63), I see that it works. And, when using the same formula for a select multiple question, it works fine (in Connect/Field App and in the Web App).
Is this a bug in the Web App + rank + jr:choice-name combination or am I doing something wrong?
Thanks in advance.
Confirming that this does work:
Maybe a limitation of the web form?
EDIT: ya, this is a web limitation.
I believe so, but it is related to the Connect version. I have already used the same scheme in other public consultation forms, on the Web, and I did not have this problem. I just do not know in which version this started.
If you know this was working in the past, but stopped due to a Connect update, I would highly recommend you open an Esri Support case and get this logged as a bug (also, post the bug # here so others can add to their profile if they run into the same issue).
I still have the same issue in Connect version 3.21.62.
Also, I noticed that the jr:choice-name function also doesn't work well in web edit mode when trying to decode a select multiple with search() appearence.
Any plans to fix this issue?
p.s.: due to restrictions in my organization, I can't access ESRI support. If someone could file a bug report for this, that would be great.
I am having the same issue. jr:choice-name(selected-at(${teste_rank}, 0),'${teste_rank}') comes up as 'Undefined' when pushed to the web-app but if I change it to jr:choice-name(selected-at(${teste_rank}, 0),'teste_rank') (No ${}) then it returns the name field instead of the label field (in the choices tab). Any ideas on how to fix this?
In my case, I was able to get around this using pulldata.
I created a csv with the name and label of the choice options. Since I was only interested in the first 3 choices, I created 3 separate questions, returning the desired label from this csv (pulldata) using the selected-at function. Then, I concatenated these 3 separate fields into a single one, separated by commas. Example below:
The same result could be obtained using multiple if statements (putting the names and labels directly in the function), but I find pulldata easier and more practical than nested if statements.
I hope this helps.