Hi, I see the last post about this was in 2015, so I’m hoping a change has been made. I deleted all data values associated with a set of organisation units, but I am still unable to delete them due to a connection with dataValueAudits. Is there a way to remove these so the OUs can be deleted?
If you have access to the database, you can execute an SQL command like
DELETE FROM datavalue where dataelementid = (SELECT dataelementid from dataelement where uid = ‘XXXXXXXX’);
DELETE FROM datavalueaudit where dataelementid = (SELECT dataelementid from dataelement where uid = ‘XXXXXXXX’);
where XXXXXXXX is the UID of the data element you wish to delete.
As from: Can't delete some data elements.
See also thread on: Unable to delete an ou.
I am trying to delete OUs that have associated dataValueAudits, not data elements…