Filter list of floristic species with 3 first letters of name

1. What is the issue? Please be detailed.
Hello to all ODK community and support ODK :grinning:, I am a GIS engineer in Dynafor unit in the research organization Inrae in France. And I and some other Inrae colleagues have been trained during 2 days at the end of April2022 on ODK by the famous and talented Mathieu Bossaert from CEN Occitanie France. Thanks to him and happy to join you :blush:. Excuse my English which is perhaps approximate.
I am in the middle of elaborating my first form to allow botanical research colleagues to carry out floristic surveys in the Pyrenees on mobile application. I am slowly but surely progressing with the help of Mathieu. Mathieu is on vacation, so I'm going to post my current block on the form. I try to filter the list of plant species displayed in ODK from the first 3 letters of the species previously entered by the collector. And due to lack of skills, I have syntax errors.

2. What steps can we take to reproduce this issue?

3. What have you tried to fix the issue?
I tried to remedy this by adding a choice_filter and/or a command line in appearance select_one_from_file espece_flore_Oo.csv with apparence= quick search('espece_flore_Oo', 'startswith', 'label', ${recherche_sp})

4. Upload any test forms or screenshots below.
Here are extracts from the form and the external csv with an extract from the list of experiments. Sorry it's in french.
espece_flore_Oo - extract.csv (398 Bytes)
FloreBaionnetteV6 - extract.xlsx (15.1 KB)

And finally here is a screenshot of the error I get in ODK Collect on my phone when I get to this screen

Thank you in advance for your help.


Take a look at filtering-options-in-select-questions, specifically

...Another example of a complex choice filter is one that uses text comparison functions to match labels that start with a certain value. Consider, for example, starts-with(label, ${search_value}) where search_value is the name of a text question defined on the survey sheet.


Hi Sylvie and welcome onboard ;-), don't hesitate to introduce yourself here and describe the use you'd like to make of ODK at INRAE :wink:

select_one_from_file can be filtered as any other select_one using the choice_filter column to write condition.
Here you want to filter every option that starts with the letters you input in previous recherche_sp question
here the following choice_filter will work


I just tried with a fake 10000 species list and it works fine on my quite old phone.

As you will see it is case sensitive :wink:

The syntax you tried to use was used to query big csv with "classical" select_one. And the error message you faced is relative to that old method.
To be more clean and standard we will try to limit as much as we can the species list instead of using the whole french list containing species we'll never see in the region :wink: .
But right now such regional lists do not exist for all species groups,
so bad bad habits die hard...

1 Like

just to add... if you do want to make it case insensitive, you could try something like this (swap the alphabets depending on whether you are matching against an upper vs lower target name):

starts-with(name, translate(${recherche_sp}, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'))


Thanks a lot for you answer. I applied your simple and effective correction and retested the form and the famous filter that works on my Android phone.
I have an error message when validating species number 2 of the same repeat on a selected station. I have the impression that line 31, the calculate liste_especes_observees with like calculation join('
', ${espece},${new_espece}) is not at the right place in the group or repeat.
You have an idea ?

Hi Xiphware, thanks also. I will improve this species selection with you insensitive case advise.

1 Like

Could you share your entire form and paste the error message ?

Hi Mathieu, here the error message. Thank you in advance

Could you share the complete form ?

FloreBaionnetteV6.xlsx (20.1 KB)
here he is. Sorry for the delay in ignition. Good afternoon

Thanks @SylvieLadet.
I added a calculate question (espece_observee) wich calculate which of the 2 species question was filled : coalesce(${new_espece},${espece})
And I use it in the join (which takes 2 parameters) :

 join('<br/>', ${espece_observee})

FloreBaionnetteV6.xlsx (16,6 Ko)

1 Like

Thanks @mathieubossaert. It works. We are ready to demo the full form to sponsoring botanists on friday 13 may. Then we can refine. Good week with the sun finally here