While working on a project, our team faced a very odd bug : a calculation that we used to use in several forms for a long time all of a sudden does not work anymore.
The calculation is concatenating answer choices as values and also their labels. The concatenation purely based on values is still working, see “3 Test” (Test was entered as text for other), however the concatenation pulling in the choice labels based on the syntax jr:choice-name is not.
And here the screenshots how it manifests itself on the phone; it is not pulling in the concatenated choices correctly on the forms hosted on Kobo…
We are using EXCEL 2013 (for xls forms), KOBO Humanitarian response & ODK Collect v1.22.4. We tested also with XLS Online as a converter from xls to xml. https://opendatakit.org/xlsform/
Expected behavior : We used to have this:
Actual behavior: But now it appears like that:
What we try :
No matter what form we use, except if for V11 as hosted on Aggregate. When loading the same version number on Kobo it does not work anymore. So it is linked to the way the xml is parsed. See down below, after conversion with xls offline, the full paths are being used, this is the version that works. Converting through Kobo or through xlsform online is not retaining the full path for the jr:choice and results in failure, only the first part of the concatenation, the ID number of the net is pulled in correctly, the label of the choice made is not.
Extracted from xml converted through online XML converter https://opendatakit.org/xlsform/
< bind calculate=“if(selected( …/NETBRAND ,‘96’),concat( …/LNTID ,’ ‘, …/BRANDOTH ),concat( …/LNTID ,’ ‘,jr:choice-name( …/NETBRAND ,’ …/NETBRAND ')))” nodeset="/GLO_FS_NET_WS_EN_FR_AR_SW_V15-XLS/Nets/NETBRAND_C" relevant=" /GLO_FS_NET_WS_EN_FR_AR_SW_V15-XLS/MOSNETS = 1" type=“string”/ >
Extracted from xml converted through Kobo and retrieved through direct download
< bind calculate=“if(selected( …/NETBRAND ,‘96’),concat( …/LNTID ,’ ‘, …/BRANDOTH ),concat( …/LNTID ,’ ‘,jr:choice-name( …/NETBRAND ,’ …/NETBRAND ')))” nodeset="/data/Nets/NETBRAND_C" relevant=" /data/MOSNETS = 1" type=“string”/ >
Converted through xls offline v1.6.0: THIS WORKS
< bind calculate=“if(selected( /GLO_FS_NET_WS_EN_FR_AR_SW_V15-XLS/Nets/NETBRAND ,‘96’),concat( /GLO_FS_NET_WS_EN_FR_AR_SW_V15-XLS/Nets/LNTID ,’ ‘, /GLO_FS_NET_WS_EN_FR_AR_SW_V15-XLS/Nets/BRANDOTH ),concat( /GLO_FS_NET_WS_EN_FR_AR_SW_V15-XLS/Nets/LNTID ,’ ‘,jr:choice-name( /GLO_FS_NET_WS_EN_FR_AR_SW_V15-XLS/Nets/NETBRAND ,’ /GLO_FS_NET_WS_EN_FR_AR_SW_V15-XLS/Nets/NETBRAND ')))” nodeset="/GLO_FS_NET_WS_EN_FR_AR_SW_V15-XLS/Nets/NETBRAND_C" relevant=" /GLO_FS_NET_WS_EN_FR_AR_SW_V15-XLS/MOSNETS = 1" type=“string”/ >
Downloading an xml from Kobo and loading it on Aggregate does not help.
It only works correctly when converting the xls through the offline tool https://github.com/opendatakit/xlsform-offline/releases/tag/v1.10.0 (note: the online xls form converter also does not work!) and loading it on Aggregate. This has been tested with release v1.6.0; i.e. we cannot confirm it works with the newest offline version .
Steps to Reproduce
Upload the following XLSForm in KOBO
apT2s7i283zkyDk6fx5vV3 (1).xls (81 KB)
Observe this issue with the question “select the brand of the net under which the household member slept” (row 61)
Might be the changes that KOBO did in the code that corrected the other bugs recently ?
If anyone have an idea will be happy to hear about it