Accessing values from a repeated select_one question outside of the repeat

795
5
Jump to solution
06-12-2020 11:37 AM
AllisonMuise2
New Contributor III

I have a survey with a repeat that contains a select_one question and a read-only text question with a calculation to look up and store the description of the selected choice. Outside the repeat I have another read-only text field where I am joining together all the choice descriptions into a paragraph. 

If the repeat count is set to 1, everything works as expected. If the repeat count is set to 2, the choice description value is getting calculated twice. If the repeat count is set to 3, the description value is calculated three times, etc.

For example, if i set the repeat count to 3 and choose the value 'one' (label: 'One') for the first repeat, 'two' (label: 'Two') for the second repeat, and 'three' (label: 'Three') for the third repeat, I expect that my final paragraph will read 'One Two Three'. Instead, the text strings within the repeat are getting calculated once for every repeat so that the final paragraph reads 'OneOneOne TwoTwoTwo ThreeThreeThree'.

The survey is built using Connect v3.9.120 and I am accessing it using the web form. I am using jr:choice-name(${stringval}, '${stringval}') to retrieve the choice description and join(" ",${domainval}) to concatenate the repeat strings.

XLSX and screenshot attached.

Can anyone point me in the direction of how to retrieve a single copy of each choice description regardless of the number of repeats?

cc Ismael Chivite

0 Kudos
2 Solutions

Accepted Solutions
JamesTedrick
Esri Esteemed Contributor

Hi Allison,

Apologies for the delay in response.  The issue you describe in the webform is being researched into; at this point it appears to be a known issue in repeat behavior.

View solution in original post

0 Kudos
ZhifangWang
Esri Regular Contributor

Hi @AllisonMuise2 ,

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.

View solution in original post

5 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Allison,

Apologies for the delay in response.  The issue you describe in the webform is being researched into; at this point it appears to be a known issue in repeat behavior.

0 Kudos
AllisonMuise2
New Contributor III

Thanks James,

Do you have any suggestions for how I can work around this in the meantime? I went looking for ways that I could slice up the final string to get the desired paragraph, but didn't see anything obvious.

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Allison,

I don't have a specific workaround, but it may be possible to create a workaround using the new javascript capability - take a look at Extending Survey123 smart forms with custom JS functions

0 Kudos
AllisonMuise2
New Contributor III

Thanks James,

Unfortunately, I'm not a JS developer so coding around this issue isn't an option for me. I hope this bug can be addressed in a future release.

0 Kudos
ZhifangWang
Esri Regular Contributor

Hi @AllisonMuise2 ,

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.