Create unique ID with DOB, name and part of contact number

Hello All,

I am trying to generate unique id by using dob, name and part of contact number. I managed to achieve as the local form and having the following challenges:

  • I need the dob as a string, not as date format
  • I want to ensure that all letters of the first name should be all caps or all small
  • I want to pick the last 4 digits from the contact number

test.xlsx (12.9 KB)

Your help will be highly appreciated.

Thanks,
Imran

First thing: "Where" do you need the unique ID? On ODK collect (meaning on the handset), it doesn't make sense (because you may not check other handsets for uniqueness). If on the aggregate dashboard, you already have META-INSTANCE-ID as the unique ID. If on custom dashboard, there are countless ways to make unique IDs.

Maybe you could explain it a bit more for our understanding.

This unique identifier is a project requirement. Previously I used other ways of generating unique IDs. However this is what I have been assigned to do.

Thanks

Something like this maybe:

concat(format-date(${dob}, '%d/%m/%y'), ${firstname}, substr(${contact_number}, string-length(${contact_number})-4))

There is no function to convert text to uppercase so I think you need to use regex to force your enumerators to use only capital letters passing first name.

3 Likes

Dear @Grzesiek2010,

Thanks so much! I appreciate your support. I tested this and this is working perfectly.

Thanks again,
Imran

1 Like

Hello @Grzesiek2010 and @A.N.M_AL-IMRAN,
there might be a workaround to get automatic upper conversion, using absolute path reference. See example.
Upper01.xlsx (12.7 KB)
Upper01

In KoBoCollect, the conversion happens seems to happen on save (see re-edit).
Before save


After save (and sent)

Maybe @Grzesiek2010 can add more hints?
Best regards

1 Like

Yes but translate function doesn't guarantee proper results in all languages as far as I know so as you said it is a workaround.

1 Like

Thanks @wroos,

For some reason, it didn't work at my end. Is it supposed to let the numerator type uppercase automatically?

Thanks,
Imran

No, it's a function that you can use to concert the value from your text question and for example use in concat.

1 Like