Auto selected field and hide from the form

Hello My Fri,

I hope you are doing well. I am writing this to seek your advices for selected option in kobo.
Regarding to the following attachment , whenever I select the Village name , I want the Village code is selected and hide from the Form.


Best Regards,

Sockea

So do you mean you want this to happen in the background without any enumerator’s control (when selecting village name the village code should be auto-selected?

Dear My Fri,

Yes, That’s correct. So, after the village name selected , The village code will automatic selected according to village Name this and the village code hidden from the form. :slight_smile:

You may use a calculate type field for the code (with a label).

1 Like

Dear wroos,

Thank you for your respond. I can add calculation , but if i have many row, are there any way, i could do faster. That’s would be help if you would give me an example .

Best Regards,
sockea

It seems that this Code is just the XLSForm name of the choice item of the village select. So, it is visible directly if you export the data or view them in XML mode.
Could you explain more what exactly you want to get, please?

If you just want to have village choice label and name together, you could create a calculate type VillageCode with calculation as ${VillageSelect}. You would neither need here a select type nor a long if formula.

Another - design - option could be to add the code at the beginning of the village label: code VillageName. If you change your choice list like this you could re-deploy the form and get the code in the label for all villages, in view and export.

1 Like

Dear wroos,

Thank you for kindly respond, I want to selected village and the village code is automatic select . I could try calculation but this will need to write a very long writing in calculation . I am not sure this is clear.
For example: I want to select village Sambour and Village code must auto pick up in the form.

Here is example with different options:
Villages01.xlsx (13.1 KB)

I added notes, to show the calculated values. To keep leading zeros in choices names, you need to write them as string in Excel XLSForm, i.e. leading ', e.g. '06050301

I would like to underline again, that code and label are available by just switching between XML Headers and Values or Labels option. See examples for table view and export below. So I don’t understand well why you need to add an extra calculate variable.

TABLE VIEW

EXPORT

A third option could be to add the label text to the choice name, e.g.

list_name   name                label
villages    06055301_Ou_Doung   Ou Doung

It would even work with blanks instead of underlines in the choice name. (At least in Enketo.)

1 Like

Dear wroos,
Thank you for your kindly respond here. I am really appreciate your respond. that’s helpful for my work. Thank you .

1 Like