Avoid duplication in commcare

Good evening all.
I have a number identifying fields where the numbers should not repeat. Is
there a possibility of a validation rule to avoid duplication?
Thank you.

Hey,

Are the numbers being assigned by the application or are they being
assigned elsewhere and then just validated in the app?

If commcare is assigning the IDs, one option is to use the user case
feature for this. This has been discussed on this forum in the past here
https://groups.google.com/forum/#!searchin/commcare-users/unique$20id/commcare-users/gnnv1DYxHdE/eshYmsSkBwAJ
and here
https://groups.google.com/forum/#!searchin/commcare-users/unique$20id/commcare-users/a3YMb6MLQXY/ClGVo6DBCAAJ
.

You may also be able to create a validation condition that searches a case
property against the local case list. This would be a complex expression
that may be challenging to troubleshoot, but it would look something like
this: *count(instance(‘casedb’)/casedb/case[@case_type=‘your_type’][id_field=/data/path_to_id_question])

0*

This assumes case type is “your_type”, you are storing the id on the case
in a field called “id_field” and the question in the form has ID “
path_to_id_question”.

It is not possible to check any cases that aren’t on the device.

Cory

··· On Wed, Apr 20, 2016 at 7:25 PM, 'Tarbangdo Felix' via commcare-users < commcare-users@googlegroups.com> wrote:

Good evening all.
I have a number identifying fields where the numbers should not repeat. Is
there a possibility of a validation rule to avoid duplication?
Thank you.


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.