Dynamically inserting OTHER as an option to a long list

Hi,

I have 100 districts and 3000 related villages behind these districts. The villages list is shortlisted automatically based on the selection in DISTRICT dropdown, using choice_filter. Now, I need to add 'OTHER' as an option in the villages list, to cover the villages which may not be present in the list, and I am subsequently giving an open text field to enter the name when OTHER is selected in villages dropdown. It seems that I have to enter OTHER as village option at least 100 times, once for each district. Is there a simpler programmable way of handling this?

Thanks,
Saad

hello, please try this under type in your xlsx file select_one village other

1 Like

This is not working. Following error appears during form upload:

The XLSForm could not be converted: Unknown question type 'select_one village other'.

Sorry, kindly use this select_one village or_other

I tried this as well. The form gets uploaded fine, but the app does NOT give me the OTHER option in the village list, below the listed choices.

It should be simple.

In the options of villages, add at the very last a value I.e 9999 as other

And for the choice-filter use district = ${district_value} or name = 9999 where district is the column that holds the filter options. In case you attach the list as csv, the same is done by referencing columns in choices and adding one option for other on the same list_name

2 Likes

Don't I have to enter OTHER option in the list of villages 100 times, by what you are suggesting? The OTHER option is not going to get listed in 100 different villages choices unless it is defined there. No?

Jules suggestion would allow you to just write it once.

As the choice filter contains an "or", it means that the OTHER option will not be filtered by district or any other administrative area. In this case the OTHER is selected by filtering the name column and no other columns. It is a very good solution to this problem.

1 Like

Haven't tried this solution before, have gone the route of repeating "other" multiple times. Will definitely be trying this out and implementing in future! Thanks for the question @Saad and the response @jules_rugwiro!

@jules_rugwiro, This works great, thanks!

One thing: Why does it only work when we add 9999 as value name for OTHER, and does not work when I add 'Other' as value name for OTHER?

Just getting curious about this @jules_rugwiro :slight_smile:

One thing: Why does it only work when we add 9999 as value name for OTHER, and does not work when I add 'Other' as value name for OTHER?

Hello @Saad,

Best guess is, all values in name should be of same data-type otherwise, you can assume all of them are text and change the choice-filter() value to district = ${district_value} or name = 'other'

In my previous response 9999 was a representation of any value you would choose to be other and if not a number, then quote it out

Hoping this helps,

Jules R

1 Like