Select_multiple choices, then rank the selected choices

I would like to select items/choices with select_multiple.
If more than one option was selected in the select_multiple, then a subsequent question (rank widget) should appear to rank the selected choices in the select_multiple question.
How can I do this?

1 Like

Hi,

Please the attached example. Hope this helps.

Thanks
example.xlsx (11.4 KB)

Thank you!
With this I can make the rank question appear when more than one option is selected, by including all the possible combinations.
Do you also know I can only include the selected options in the rank question?

2 Likes

Hie Svenja How can you only include only the selected options in the rank question?

You can filter rank choices the same way you filter select_one or select_multiple choices! In your XLSForm, write a choice_filter for the rank question. This filter should only match options which were selected in the select_multiple question. You can use the selected function for this. It will look something like selected(${your-select-q}, name). name refers to the name column in the choices sheet.

Please see this sample form for a working example.

2 Likes

The choice_filter was working for us before but since we upgraded odk central to v2023.2.0 the rank widget does not allow to move the answers anymore when a choice_filter is applied, both in enketo webform and in the odk collect app. I tried the sample form posted here and the problem also happens with it. It shows the relevant options, but ranking is not possible.

Hi @tei_aqysta

Welcome to the ODK forum. We're glad you're here. When you get a chance, please introduce yourself on this forum thread.

What do you mean by that? Do you see the options but can't move them or what?

Hello @Grzesiek2010 Alright, I introduced myself.

Indeed, when a choice filter is applied to my rank type questions, I cannot move the answer options when filling out the form (both in web and in odk collect app) to put them in a different order to rank them.

This is the example form posted above (in enketo web) with choice filter applied to the rank type question:
image
You dont see the typical 4 dots of a rank type questions, and I cannot move them to change the order.

And this is the same form, but without the choice filter applied to the rank question:


Here you do see the 4 dots, and I can move them to rank them

When it comes to Enketo it doesn't work indeed Rank widget not working in Enketo but in ODK Collect everything seems to be fine. What version of ODK Collect are you using?

Hi @Grzesiek2010 ,

My apologies I now see that it does work indeed in ODK collect, I was not holding it long enough. However, we use it mainly with enketo and it did work there as well, before we did the upgrade of odk central.

Ok as I aid above it is broken in enketo indeed. You can track the changes here https://github.com/enketo/enketo-core/issues/981

My assumption is that this bug will not be fixed because the focus is developing the new webforms, is that correct? Maybe I already asked this question somewhere else already, but is the new webform platform that is being developed going to fix this bug? I'm not sure how much the new platform is inheriting from Enketo code. I was planning to launch a short survey using this logic this week, but looks like that may be delayed quite some time.

It's unlikely the ODK team will get to this bug before the end of 2024 when we transfer maintainership of Enketo to the Kobo team. I'm hopeful the Kobo team will communicate their priorities at the time.

ODK Web Forms (see preview) is a complete rethink of how we do web forms in ODK. One of the reasons we are building it is to prevent bugs like these that we found hard to fix. There is no shared code with Enketo.

1 Like

@Tyler_Depke I'll try to take another look at this in Enketo soon. I didn't realize that it was a relatively recent regression, my recollection was that it didn't look like a straightforward fix.

Could you please try your simple form with this requirement at https://getodk.org/web-forms-preview/? Is there other functionality missing or is it just the ranking of filtered choices?

I also remember you'd mentioned a more complex form that lead to a blank screen. We've now added an error message if there are form load failures that should give you more information about what's happening. Feel free to direct message me the form and we can make sure that we are tracking all the appropriate issues.

Here is the simple form that isn't working:
rank-filtered-from-select.xlsx (5.3 KB)

It is indeed just the sample that you provided a while back and has a select multiple, then a rank question with a choice filter based on the answers selected in the select multiple.

The screenshot below is showing rank as an unsupported form definition / question type.

This was not the original complex form that I had that wasn't working, I'll reply with that separately.

1 Like

Here is the original complex form that I tried after the call and just showed a blank screen. Not sure what stage you'll be testing pulldata abilities, but it seems to be caught on that currently. Now it is showing this when I click the preview button:
Farm_Observations.xlsx (164.3 KB)

An error occurred while loading this form
todo function not defined: pulldata
Technical error details
Error: todo function not defined: pulldata
    at castError (https://getodk.org/web-forms-preview/app/assets/index-fmqYiZXt.js:29:732803)
    at handleError (https://getodk.org/web-forms-preview/app/assets/index-fmqYiZXt.js:29:732903)
    at runComputation (https://getodk.org/web-forms-preview/app/assets/index-fmqYiZXt.js:29:730405)
    at updateComputation (https://getodk.org/web-forms-preview/app/assets/index-fmqYiZXt.js:29:730161)
    at createMemo (https://getodk.org/web-forms-preview/app/assets/index-fmqYiZXt.js:29:728442)
    at https://getodk.org/web-forms-preview/app/assets/index-fmqYiZXt.js:43:53282
    at https://getodk.org/web-forms-preview/app/assets/index-fmqYiZXt.js:43:50746
    at runUpdates (https://getodk.org/web-forms-preview/app/assets/index-fmqYiZXt.js:29:731457)
    at runWithOwner (https://getodk.org/web-forms-preview/app/assets/index-fmqYiZXt.js:29:728975)
    at Object.kt [as runTask] (https://getodk.org/web-forms-preview/app/assets/index-fmqYiZXt.js:43:50736)

The XLSForm has a lot of unnamed groups and an unnamed repeat.
This was the error message I got after uploading the form, before clicking preview:

There are following possible problems in the uploaded Form:
Language 'English (en)' is missing the survey columns hint, media::image.
Language 'Français (fr)' is missing the survey columns hint, media::image.
Language 'Konyanka (mku)' is missing the survey hint column.
Language 'default' is missing the survey columns label, media::audio, media::image.
Language 'Français (fr)' is missing the choices media::audio column.
[row : 52] Group has no label: {'name': 'group_wo_barcode', 'type': 'begin group'}
[row : 53] Group has no label: {'name': 'group_cashew_new', 'type': 'begin group'}
[row : 70] Group has no label: {'name': 'group_germination', 'type': 'begin group'}
[row : 186] Group has no label: {'name': 'group_transplanted', 'type': 'begin group'}
[row : 188] Group has no label: {'name': 'group_transplanted_yes', 'type': 'begin group'}
[row : 217] Group has no label: {'name': 'group_hole_dimensions', 'type': 'begin group'}
[row : 248] Group has no label: {'name': 'group_nursery', 'type': 'begin group'}
[row : 259] Group has no label: {'name': 'group_monthly', 'type': 'begin group'}
[row : 261] Group has no label: {'name': 'group_container', 'type': 'begin group'}
[row : 269] Group has no label: {'name': 'group_plant_action', 'type': 'begin group'}
[row : 292] Group has no label: {'name': 'damage', 'type': 'begin group'}
[row : 314] Group has no label: {'name': 'group_propagation', 'type': 'begin group'}
[row : 380] Group has no label: {'name': 'group_compost_new', 'type': 'begin group'}
[row : 421] Group has no label: {'name': 'group_harvest', 'type': 'begin group'}
[row : 436] Group has no label: {'name': 'group_harvest_cashew', 'type': 'begin group'}
[row : 447] Repeat has no label: {'name': 'repeat_cashew_apple', 'type': 'begin repeat'}
[row : 494] Group has no label: {'name': 'group_grass_cutting', 'type': 'begin group'}```
1 Like

Thanks for the follow-up!

I'm glad we have a more helpful error message now. We haven't scheduled pulldata implementation yet but we're getting very close to having all the pieces in place for it so it may not be long. I don't think we'll make it possible to attach files for the preview, though, so we'll likely need to try forms with attachments on Central.

The XLSForm has a lot of unnamed groups and an unnamed repeat.

That's not a problem. I often deliberately omit group labels for stylistic reasons so I have wondered whether we should consider dialing back these warnings. Repeat labels are very useful for Collect, though!