Cascade Question Select Many Error - KoBoCollect Only

Good morning people, hope we’re all good? Got a cascade answer error I need a bit of help with please.

I’ve created a form with a cascade select answer developed via an XLS Form, it’s a select many cascade over three questions, so a lot of options.

Everything seemed to be working fine and it was tested on the web/Enketo version of KoBo and running smoothly. However on KoBoCollect the situation isn’t the same. Whatever option is chosen to the 1st question, all the options for the select many in questions 2 and 3 come up.

For context, I’ve already tried to clear the cache on the app which hasn’t done anything. My app is also up to date.

It also would be worth noting the cascade questions are housed in a group with non-cascade questions.

The wider form outside the XLS for the cascade was created in the web based form builder also,

Finding it strange as the cascade is 100% working in the Enketo version.

If anybody can advise it would be highly welcome.

Thanks

Welcome back to the community, @wurzel_grumage! Maybe you will need to share your XLSForm with the community. The community should help you solve your issue.

1 Like

home_maintenance_cascade_update_01.2025_for_community.xlsx (24.2 KB)

Thanks for the heads-up @Kal_Lam hope you’re doing good? Been a while! I’ve attached what’s been submitted for reference here.

It still works on the webform but not the app, I just tested the set out on KoBoCollect on it’s own w/out the other questions added through the KoBo web based builder but having the same issue.

Any help would be most welcome. Thanks.

@wurzel_grumage. I tried it on my end and did not have any issues in both the Enketo as well as the Collect Android App.

1 Like

@Kal_Lam thanks for coming back and checking things out, much appreciated. Before I can confirm this is a solution though, just wanted to make sure we’re on the same page. As for me and my colleague the questions go through and work on both Enketo and the Collect Android App, however the cascade does not function on the app.

As an example I provide the below pictures for reference. If I select Prosthesis as the answer to the first question I get the below follow on options on Enketo

As you can see there are only four possible options. However doing the same on the app brings all the potential answers from the initial response. I provide a picture below for context where I only selected ‘Prosthesis’ in the first question:

as you can see, there are way more than four responses. If I understand from your case then, as an example on the app you’re only getting the four responses as above for the 2nd question when selecting ‘Prosthesis’?

If that is the case, what could be the issue with me and my colleagues apps? Are we running on different versions? I’m on v2024.2.4.

Any further assistance would be most appreciated.

@Kal_Lam hope you’re having a good weekend? Did you have any feedback on my response above? For now we’re just running with the Enkteo version, and continuing to have the problem with the form on KoBoCollect.

Any further guidance would be appreciated.

Cheers

The root of the issue here appears to be a subtle difference between how Enketo and Collect are evaluating choice_filter expressions, specifically when dealing will empty/null fields. Let me explain…

In your form you have, say when selecting ‘Prostetics’ (above):

type name calculation
calculate CC if(selected(${Q1}, 'prosthetic'), 'condition3', '')

Note that when the user has selected ‘prosthetic’ in Q1 then CC=‘condition3’. However, the important thing to note is that when they have not selected ‘prosthetic’ then CC=‘’, or blank/empty.

Now, looking at your original choices:

That is, filter3 - which is being used in your form to check the calculation ${CC} - will find a match (ie the choice_filter = TRUE) for any work_done options where filter3=${CC} [since the choice_filter is OR’ing everything together, it only takes a single element of this long expression to evaluate to true to make that option be included!].

If the user selects ‘prosthetic’ then ${CC} will equal ‘condition3’, so all the first 4 work_done options that have filter3=‘condition3’ will match. Exactly as you intended.

However, if the user does not select ‘prosthetic’ then ${CC} will equal blank, so all the remaining work_done options that have filter3=blank will also match (!). Exactly not as you intended. :slight_smile:

Hopefully you see the problem. Collect is strictly speaking behaving correctly, and returning all options where the choice_filter evaluates to true; and in the case of a blank entry in your choices, coupled with a blank calculation result, a blank=blank is (also) true, so basically everything is getting returned by the filter!

There are a few ways to fix this, a simple one I’ve done here is mark everything else instead with an ‘x’; that way the choice_filter wont evaluate to true and the option will get correctly filtered out. eg

b155a5fae61b1e04712cae363797e65dac1461be_FIXED.xlsx (28.6 KB)

I’ve tested this under both Collect and Enketo and I believe it works as (you) intended.

Please note I have not made the same changes to parts_used, which will suffer the same fate. But hopefully its clear now what’s happening and why, and you can make the necessary modifications to your form.

[All that said, I’m now a little curious why Enketo is (mis?)behaving in this way…]

2 Likes

@Xiphware thanks for doing some further digging on this and working the issue out, much appreciated! I’ll follow your workings and update as advised.

Thanks also to @Kal_Lam for your help in getting this resolved.

Apologies for the delayed response to this also, I’m currently working in West Africa and not able to respond as quickly as I’d like.

Either way, thanks again! This has been a big help.

2 Likes