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
Solved! Go to Solution.
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.
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.
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.
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.
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
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.
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.