Good afternoon! I have a field where duplicates should not be stored. The value for this field is generated automatically.
I created the following check: d2:countIfValue(A{caseID}, A{caseID}) > 1.
However, it doesn’t work consistently: sometimes it triggers, and sometimes it doesn’t. Has anyone faced a similar issue? Could you please suggest a proper solution? Thank you in advance for your help!
The docs says this is to be used with data elements:
d2:countIfValue (dataElement, value) Useful only for enrollment program indicators. Counts the number of data values that matches the given literal value for the given program stage and data element in the course of the enrollment. The argument data element is supplied with the #{programStage.dataElement} syntax. The value can be a hard coded text or number, for example ‘No_anemia’ if only the values containing this text should be counted. (source)
Does this mean that the TEA should be unique? If so here are the instructions to how to make TEAs unique: Programs - DHIS2 Documentation
However, based on your question, I’m guessing this is not the case? How can TEAs be duplicated in your use case? Does the unique option help?