Get value of the first choice option from select one question

1. What is the issue? Please be detailed.
I am trying to pull a value from pre-loaded CSV based on multiple conditions.

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

3. What have you tried to fix the issue?
I have tried pulldata, search method. Both works with single condition.
So I am using Select_one_from_file question type with multiple conditions in column Parameter.
I get result I am searching for as a list.
Now I want to fetch this value and use it in next question.
Any method I can fetch first value from options in select_one question? Based on the Index may be?
It works once I select the option. But I am looking for a solution without selection.

Thanks in advance!

4. Upload any forms or screenshots you can share publicly below.

1 Like

Are you able to attach your draft XLSForm here? It might help with understanding your goal.

1_form-design - test.xlsx (27.8 KB)
saplings_dist_list.csv (336 Bytes)

please see attached form.
I have highlighted the cells in yellow color where the issue is

1 Like

Are you trying to get the response value from a select_one inside of a repeat and use it inside the repeat? Within a repeat, you can reference other questions in that same repeat instance in the usual manner. If you have a select_one with the name set to trees_dist you can get the response value using just ${trees_dist} while still inside the repeat. See the docs on repeat recipes and tips:

1 Like

Thank for the response @danbjoseph
I tried few other ways. somehow still not able to solve the issue.
Any possibility you can highlight in the xlsfrom attached in previous message.

i made some minor changes to the display. but am not sure what is your expected functionality - what are you trying to do that is not working?
1_form-design - edited.xlsx (28.1 KB)

Did you select the choice from the question 12.1 and 12.2 ?
I am trying to fetch the value without selecting the option in list.

Whole purpose of doing this is fetch to value from CSV that satisfy multiple conditions.
with Pulldata, search it is not possible.

If I can rephrase my question, Is it possible to access the entire choice list from select_one option without selection and fetch value based on the index?

The same choice_filter you defined to get the options that you want can also be used in other expressions. You can then also add position-based indexing to this. If your csv is named my_csv and the choice filter you defined is <my_choice_filter>:

instance('my_csv')/root/item[<my_choice_filter>][position() = 1]/name

That would give you the value of the first item in your filtered list. If you want the label, you can replace name with label (or any column you want to use to display the item) if it's a single-language form. If it's a multi-language form, you'll need to use the jr:choice-name function.

More context on writing these kinds of expressions at


This worked LN, thanks a lot.
I used the above expression with "calculate" question type, that's correct right?

My CSV is with multiple columns (different structure than external choice sheet), therefore instead of name and label I had to use the actual column name.


I'm glad the example got you what you needed!

Yes, I imagine you'll want to first save the value in a calculate and then do what you need to do with it. You can also use this kind of expression anywhere an expression is allowed (constraint, etc). If you want to use it as a default, make sure you read the documentation on dynamic defaults.

1 Like