Select to view content in your preferred language

Rank + jr:choice-name + web app: return 'undefined'

643
6
09-10-2024 06:23 AM
SMH-Rio
Frequent Contributor

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.

 

SMHRio_0-1725974340075.png

 

SMHRio_1-1725974444083.png

 

 

0 Kudos
6 Replies
abureaux
MVP Frequent Contributor

Confirming that this does work:

abureaux_0-1725976120567.png

abureaux_1-1725976133630.png

Maybe a limitation of the web form?

EDIT: ya, this is a web limitation.

0 Kudos
SMH-Rio
Frequent Contributor

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.

0 Kudos
abureaux
MVP Frequent Contributor

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).

SMH-Rio
Frequent Contributor

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.

0 Kudos
MattFountainPlanCommunities
New Contributor

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? 

0 Kudos
SMH-Rio
Frequent Contributor

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:

SMHRio_0-1742350759965.png

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.

0 Kudos