Designing an autocomplete question from a mixture of preceding questions containing texts and integer

I am creating a survey which enatiks developing a Unique Facility ID as part of the data. This Facility ID is an alphanumeric ID. The idea is to populate the Faculty ID question with a combination of the responses to the preceding questions.
Q1: Geopolitical Zone-Text
Q1: State located-Text
Q3: Type of facility-Text
Q4: Study Phase-Integer
Q5: Facility ID-Integer
Q5: Unique Facility ID-Alphamumeric
I would appreciate any help I can get in this regard.
Many thanks

Welcom @cyrilobasuyi,
You can use a calculation with the concat() function, see ODK XForms Specification.

If you need to get fixed number formatting/positioning (incl. leading zero), you can multiply the original number parts, e.g. 1.000 + 10× firstNumber (1 or 2 digits) + lastNumber (1 digit).

Hint: The ID will always be recalculated on edit/save, except you use the once() function.
The ID should be read_only or a (hidden) calculate type.

You might use the search feature of this forum to find several examples for unique ID creation.

1 Like

Thank you very much

1 Like

Thank you very much. I solved the issue using stepped substr() and concat() functions. For the leading zeros l, o used a regex to sort that out. Many thanks again wroos

Hello,
The solution worked for me too thanks to the community and the members for the solution.
KFC Customer Satisfaction Survey - Welcome

Best regards,
Shirley

In our experience, adding leading 0s has advantages, e.g. xx001yy, xx010yy and xx101yy will all get the same fixed format which can easily be parsed/extracted, seen and sorted.