Preselect a choice of select_one type

I have an xlsform (used in ODK collect) with a select_one field, which is populated automatically based on a choice_filter. This value has to be read_only.

I am trying to find a way to select by default the option (preselected). Is it possible?
Alternatively, I can set the read_only to "no". But this would add one extra step for the data collectors.

Hi @dkarakostis

It should be possible using calculation but you didn't attach your form so can't be sure. Could you do that? Ideally a small form that shows your problem if the original one is big or contains private data.

@Grzesiek2010 I attach a part of the form. The select_one field which I am referring is in the line 11 of the xls form.

Thank you.
SMPMS_20190726_0220.xls (59.5 KB) MyCom.csv (284 Bytes)

Hello,
You can even do both, like for CommodityNameApples
calculation: '345' and read_only: true (or yes).

Side-note: If the user doesn't need the code, you might also use a variable of type hidden. Disadvantage, no labeling (and not in print-out and report, but in dataset & tables).

1 Like

Hello @wroos, @Grzesiek2010, @dkarakostis

Im not totaly clear , can you help me with this xlsform (a simple example).
The objetive is select by default the option preselected using choice_filter.
How to express the calculate?.
Link in ENKETO
Example xlsx:example_choice_automatic.xlsx (30.4 KB)
image
Thanks.

@famador
why do you have duplicated options in all sets:
image
what do you want to achieve?

Hello @Grzesiek2010.

The example do not have all options, but in the archive that i share all codes have the same actividad(Cosecha Mecanizada). The codes are machine codes, all machine used to the same activity.
So the objetive in this example is the automatic select of options , to delete the manual select:

So after adding answer to the first question Código de equipo you want to populate the rest 5 questions with one matching option and make it selected automatically? Do I understand it correctly?

Hello @Grzesiek2010.

Yes that's right , the matching option is functional, only automatic selection is missing.