Including a label answer in a following one into a loop

Hi everyone,

Description
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/

Example :
Expected behavior : We used to have this:
image

Actual behavior: But now it appears like that:
image

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.

image

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)

  • Fill it

  • 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 :slight_smile:

Thank you,
Chloé

Hi @chloelaborde
I need to get more context as I look at it. Which platform did you use to design the current form?

I am also seeing a line that seems off in the syntax especially the closing the opening and closing ’ ’

if(selected(${NETBRAND},‘96’),concat(${LNTID},’ ‘,${BRANDOTH}),concat(${LNTID},’ ‘,jr:choice-name(${NETBRAND},’${NETBRAND}’)))

Regards
Stephane

Hey @stephanealoo thank you for your answer,

About the platform as mentionned above 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/. I also test my form with the old and the new version of ODK XLSForm Offine v1.6 and v1.10. What more information do you need?

I tkink there is nothing wrong with the syntax as it works normally and used to display it in the good way before…

For the moment, I am trying to find a difference in the code btw the two versions of ODK XLSForm Offline but I did not manage to find something yet.

Thanks again
All the best,
Chloé :slight_smile:

Just to let you know:

I tested it through the offline tool. And we deal with the same issue as with the online one. It works with the v1.6 (https://github.com/opendatakit/xlsform-offline/releases/tag/v1.6.0) but not with the v1.10 (https://github.com/opendatakit/xlsform-offline/releases/tag/v1.10.0). When we checked the XML code we observe the same thing as with the online one.

I also published it on the ODK Forum