Select default values

I have a form where i have to generate auto SEC Code on the basis of Education and Number of durables. For eg: if Education is 1 and Number of durables is 2 then SEC will be E1 will be automatically selected and this field will be read only. Also attached the Soft copy for your reference. Kindly help in this regard.

Try this, using a calculation for sec:

${sec}: calculation = concat(${education},${durables})

I’m not quite sure what you are asking here… Do you want to pre-select a particular option in a select_one question? If so, and your select_one is read-only, then I assume you are merely using a select_one for display purposes only (since the user cant change anything). Correct?

1 Like

Yes i have a select_one which will be read only and will have a default value selected based on the previous question. But i have got your answer clearly. Suppose i have a numeric field as age where the user will enter his age between 18 to 30, and my next question is a select_one as read only, where there will be 3 options 18 to 22, 23 to 27 and 28 to 30, and depending on answer provided in the age field, this will be automatically select. Hope it clarifies the question.

Try playing around with this:

selectdefault.xls (26 KB)

(adding a constraint to enforce an 18-30 age range is an exercise left to reader… :wink:

1 Like

It works fine in Enketo but return an error while come to age range screen. Tested it KoBoCollect v1.23.3k.

Thanks a ton this is what i wanted. Thanks a lot. This is actually a very needed feature.

1 Like

Just put a colon before and after for eg: if(${age}<18,‘4’, if(${age}<23, ‘1’, if(${age}<28, ‘2’, if(${age}<31, ‘3’,‘4’) ) ) ) it will work in the app too.


I guess if the solution works you might argue this feature is already ‘supported’ (albeit somewhat obscurely)… :grin:

Thanks for the reply it worked for me.

1 Like