Calculate name function - name only appears in first repeat instance

**What is the problem? Please be detailed.**I am working with a repeat group where I am asking farmers the number of plots they cultivated - now, for each plot I have questions on crop cultivated and unit of measure for seed. I would like that for each plot, the name of crop selected, and name of unit of measure for seed to show up. This only happens for the 1st plot. - name doesn't show up in subsequent crops if farmer has say 2 or more plots.
I attach an excerpt of the xls, and will highly appreciate your help trial2.xlsx (13.4 KB)

Thanks a lot!

What ODK tool and version are you using? ODK Collect v1.14.2
And on what device and operating system version?

What steps can we take to reproduce the problem?

What you have you tried to fix the problem?

Anything else we should know or have? If you have a test form or screenshots or logs, attach here.

Any help please? Thank you

Hi @mugambii

Using selected-at you need to use selected-at(${crop},0) not selected-at(${crop},position(..)-1).

Why? Because the first argument in selected-at function is a list of selected indexes, in your case where you have:

if you select Coffee the list contains one element with index 1
if you select Tea the list contains one element with index 2 etc

as I said it's always one element since you use select_one question that's why you need to use 0 in that function as a second parameter - 0 because it's the first index of the list.


Perfect! Thank you very much @Grzesiek2010

I have another question on repeat group: I am asking the respondent to select the information sources they used, and for each there are two follow up questions on practices learned from that particular source, and the frequency of receiving information from that source. Now, I would like that if one selects 'Own experience' as a source of information (either alone or as one of the choices), then the question on frequency should not appear (i.e, i do not want to ask the respondent the frequency of receiving info. from own experience).

I will sincerely appreciate your help in setting up this relevance. I attach the sample form heretrial5th.xlsx (11.6 KB)


you can use not(selected(${infs}, '1'))

Thanks a lot @Grzesiek2010

I have tried, but when I select 'own experience' along with other choices e.g lead farmer (it's a select multiple question) the question doesn't appear for the other selected options as well. i.e the relevance 'disables' the question for all options selected, not just 'own experience'.

Thanks, Mugambii

1 Like

So you want to show that question if Own experience option is selected and nothing more? If so please try this:
not(selected(${infs}, ‘1’)) or count-selected(${infs})>1

Thank you @Grzesiek2010
I would like that the question on 'frequency of receiving information' doesn't show for the option of 'own experience'. If for instance a respondent received information from lead farmer and own experience, the follow up questions for lead farmer should be on practices & frequency; while for own experience it should be just practices. In other words, I do not want to ask respondents the frequency of receiving information from own experience., but this question should be asked for other sources of information.

Thank you,

Now it's clear, so you can use not(selected(${infs}, ‘1’)) or position(..)>1