join() from repeats, but return labels?

823
5
Jump to solution
07-24-2020 10:10 AM
TomSchwartzman
Esri Contributor

I have a repeat. Inside the repeat is a select_one field from a list like below:

list_namenamelabel
proplist1prop1 
proplist2prop2
proplist3prop3
proplist4prop4
proplist5prop5

I want to present the user with a list of what they have chosen in the repeat - the join( ) command is useful here, and works, but returns the name from the entry and not the label.

Example:

I enter 2 records in my repeat, where I chose from the list prop1,prop3.  The output of join shows "1,3".  Which is correct.  

join() on its own:  join(',',${property})   (shows 1,3)

What I want is the join() to show "prop1,prop3".  

I've tried using jr:choice-name inside my join() function but that doesn't seem to work.

join() with my non-working use of jr:choice-name:   join(',',jr:choice-name(${property},'${property}'))

Perhaps someone can point me in the right direction.

Sample survey attached.

Thanks for any help,

Tom S.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ZhifangWang
Esri Regular Contributor

Hi Tom Schwartzman‌,

Thanks for the feedback and the test XLSForm file.

After looking into the issue, I can confirm it's a bug that if you want to join the labels of a select_one question in a repeat by using join() + jr:choice-name() functions, the result will be duplicated N times where N is the current repeat count.

I've logged one issue in our dev repo. It will be good if you can also raise an issue to Esri Support to prioritize the issue.

Thanks,

Zhifang

View solution in original post

5 Replies
Philip-Wilson
Esri Notable Contributor

Hi Tom,

Have you tried moving the jr choice name outside of the join expression? Put each one in is own hidden/null field so that the label is displayed only in that field for each response, and then do the join based on those hidden/null fields, that should work as you are expecting.

Regards,

Phil.

0 Kudos
TomSchwartzman
Esri Contributor

Thanks Phil.  That does work, but not in my use case but only in the web survey.  In my repeat I added a hidden null field of the jr:choice-name, and then outside the repeat I join those up.  

However in my survey, where you specify the # of repeats before getting into the repeats themselves, this does not work right.

In the survey app, I see prop1,prop2,etc and it grows as I add properties to the repeat.  That is good, and what I expect.

In the web app, say I choose 3 repeats in advance, I see prop1,prop1,prop1,prop2,prop2,prop2....

I will upload screenshots and xlsx

0 Kudos
ZhifangWang
Esri Regular Contributor

Hi Tom Schwartzman‌,

Thanks for the feedback and the test XLSForm file.

After looking into the issue, I can confirm it's a bug that if you want to join the labels of a select_one question in a repeat by using join() + jr:choice-name() functions, the result will be duplicated N times where N is the current repeat count.

I've logged one issue in our dev repo. It will be good if you can also raise an issue to Esri Support to prioritize the issue.

Thanks,

Zhifang

TomSchwartzman
Esri Contributor

Thanks Zhifang.  Will submit to support as well.

ZhifangWang
Esri Regular Contributor

Hi @TomSchwartzman ,

FYI, the issue has been fixed in the web app in our October release , you can have a try and please let us know if you still observe any issue.

0 Kudos