CommCare – Check Unique Case Property Against Saved Cases

commcare

In a workflow where fields entered in a registration form are concatenated to create a unique ID (IE municipal and district IDs, date of birth, first two digits of first and last name, etc) and saved, is there a way to check the saved ID case property against the other existing IDs of the other cases to ensure you're not creating an identical ID?

Best Answer

I don't think there is a way to actively check (especially given the offline functionality).

The best design solution I can think of is:

  1. The domain must be on the Standard Plan for User as a Case to be available
  2. Add custom user data number for each mobile worker (e.g. mobile user 1 = 01, mobile user 2 = 02)
  3. Add a counter that would increment for each case registered by each mobile worker
  4. Add the custom user data+counter number to each of the UIDs for the cases (e.g. the first case registered by mobile user 1 would be 011 = user case property + counter number)
Related Topic