Automatically generate unique IDs by concatenation

Hi every one,

I would like to automatically generate Unique Ids by concatenating Org unit code + First letter of Gender + First letter of first name + First letter of last name + month + year extracted from date of birth.

Any help would be appreciated. Thank you.

Hi @fernando.

I don’t think can use the generated ID for that, as you are using values that are filled after the creation of the TEI (see ) . Also, what you are describing is not going to work as you could have two people, born on the same month, on the same year, in the same OU, with the same gender and with similar first letter of both name and surname.

For example, this two TEI would collision.

  • Juan Gomez, born on 10/10/1980 registered in Madrid, España
  • Julian Garcia, born on 03/10/1980 registered in Madrid, España

You will probably need to use the autogenerated id to add a sequence (or a random) to your string. So with that, and some program rules (using d2:substring or d2:split and d2:concatenate) you should probably achieve what you want.


1 Like

Hi @jaime.bosque

Following the link, I will have a look at the manual and say something after.