How to: Create ID Numbers and response with validation criteria

Dear Experts,
Greetings! I am preparing a XLS Form for data collection.
I am facing below problems during creating form

I can’t create a ID i.e. automatically display like: KURI-CHIL-THAN-ULI-00001) in the form.,
For example;
District Name: Kurigram
Upzila Name: Chilmari
Cluster Name: Thanahat
Village Name: Ulipur
Household Serial Number: 00001
Household Identification Number will be: 3 letter for District Name-3 letter of Upzila Name-3 letter of Cluster Name-3 letter of Village Name-Household Serial Number (will automatically display like: KURI-CHIL-THAN-ULI-00001)

Could you please help to solve this issue to develop in XLS Form /guideline would be highly appreciated.

Best Regards,

Palash Sarkar

Hi @PALASH9698,

Welcome to the community! Please see the discussion that has happened earlier which should solve your issue of creating a unique id through an existing variable:

Have a great day!

Hi @PALASH9698
Just to expand on what has been suggested by @Kal_Lam, you can also look at the following approach.

You operation requires multiple functions

  1. Extract the first three letters of every place i.e. district etc. you can use the substr command as follows substr(${District},0, 3) note this will pick the first three letters from each question/column e.g District in this case. If you need 4 letters, replace the 3 with 4
  2. The last bit is that we cannot automatically create a serial number from 0 to maximum, so the suggestion would be you add this manually and a such create a text question that allows one to enter. it could be e.g. serial
  3. Combine what you have extracted into one using concat command where e.g in the below I am combining the first 3 letters of each column. You can expand the below to include everything.
    concat((substr(${District},0, 3)),"-",(substr(${Upzila},0, 3)),"-",(substr(${serial},0, 3)))

Stephane

2 Likes

Thanks a lot

Could you please give me a
Reference xlsform
Where i can clear understand and view the process. Thanks for understanding my problem.

Regards
Palash Sarkar

Hi @PALASH9698,

Would you mind having a look here for the discussion that has happened earlier. It also has an example with a reference xlsform for better understanding.

Have a great day!