Is there any way for enforcing unique values in dhis2 data elements? e.g. to check if the value that has been entered already exists in the system or not. In my case am having a questionnaire that requires users to enter an HCC number but number should only exists once in the system. Is there any way to enforce that like maybe using d2 functions in the program rules or anything else.
Thank you for your question! To the best of my knowledge, it’s not possible to compare data elements in the entire system during data entry; however, the metadata that can be set as unique is the tracked entity instance attributes. I don’t know the specific use case so I have a suggestion that might work in some cases and might not work depending on the use case.
It is possible to make the questionnaire a Tracked Entity Instance, and all the questions can be attributes. The ones that must not be repeated can be set as unique for Entire System:
I hope this helps!
thank you @Gassim this is a great clarification
1 Like