How to make a unique id (like XX><XX><XXXXX) in KoBoToolbox

How can I make special format for ID like below

<2/3 letters><ZP/TC><86343>

Hi @kawo786,

Please see the discussion that has happened earlier which should guide you on how to create unique id based on your available variables:

Have a great day!

Dear Sir, I understood this but I do not want that the user will right serial number after 2 part like

Hi @kawo786,

Could you provide us some examples so that we could have a look at it.

Have a great day!

The person will select from dropdown one of this 4 options:

  1. Kandahar
  2. Nimroz
  3. Nangarhar
  4. Kabul
    and after that the person will select this two option:
  5. ZP
  6. TC
    and after that the system will give an unique automatic ID with 5 or 6 digit numbers
    and all of the above will be concatenation and the result will be:
    and this above ID will be unique and just for one person if this will be offline or online because many users will use this questionnaire at the same time.

There could be a workaround which relies on use of various functions. From the look of things, you should probably know that concat works perfectly fine as calculation. I would therefore suggest the following steps:

  1. For the first drop down, you must define the values in the choices sheet to be the letters you want for each of the four choices. Let us call this ${Q3}
  2. For the second part, the values should be the letters you want too. Let us call this ${Q2}
  3. The third part, you should create a calculate question with the formula **substr((today()*now()random()100),0,6) Let us call this ${Q3}

For the last part, you now need to create a unique ID which should be a text question but with a calculate option added to it. This you can do in XLS. You will need the formula concat(${Q1},"-",${Q2},"-",${Q3})

This is a sample of the XLS file for doing that TestCalculate.xls (26.5 KB)

The look and feel would be something like this.

Create a random generated number with 6 digits, this could be the specific time and date

Hope this helps



Thanks a lot sir

1 Like

Hello! Does this number change if I edit the form, you see I need to evaluate and send back the form with maybe some changes, is there a way I can get a number that’s unique and that doesnát change with the edits