Delete Validation Rules

Dear all,

DHIS 2.29

I try to delete a validation rule on my database but the system response a message:

Could not delete due to association with another object: ValidationResult

This mean we need to delete Validation Result before delete Validation Rule

Does anyone know how to delete Validation Result, if you don’t mind please share.

Thanks,

···

Em Le Hong
DHIS2 Implementation| **HISP Vietnam **

em.hispvietnam@gmail.com | Skype: em.hispvietnam@gmail.com

Hi Em

I’m not sure if there is any UI for deleting validation results, but you can do it yourself in the database.

The validationresults are located in the table “validationresult”, and it has a column called “validationruleid” which links to your validation rules.

So you need to find that validation rule in the “validationrule” table, and use that “validationruleid” to delete the correct rows from the “validationresult” table.

“DELETE FROM validationresult WHERE validationruleid=??”

This does sound like a bug though, so please file one in JIRA

···

On Tue, Aug 7, 2018 at 5:07 PM, Em Le Hong em.hispvietnam@gmail.com wrote:

Dear all,

DHIS 2.29

I try to delete a validation rule on my database but the system response a message:

Could not delete due to association with another object: ValidationResult

This mean we need to delete Validation Result before delete Validation Rule

Does anyone know how to delete Validation Result, if you don’t mind please share.

Thanks,

Em Le Hong
DHIS2 Implementation| **HISP Vietnam **

em.hispvietnam@gmail.com | Skype: em.hispvietnam@gmail.com


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Morten Olav Hansen

Senior Engineer, DHIS 2

Team Integration Lead

University of Oslo

http://www.dhis2.org

Hi

Agree with Morten that it’s a bug - it should be obvious that if you delete a validation rule, any old validation rule results are no longer of interest (with the rule deleted, you would not even know which rule any remaining results were referring too).

So the solution here is that when you delete a validation rule, the system should automatically first delete any dependent records in the following tables, which have validationruleid as a foreign key:

“validationnotificationtemplatevalidationrules”

“validationresult”

“validationruleattributevalues”

“validationrulegroupmembers”

“validationruleorganisationunitlevels”

“validationrulesynchstatus”

“validationruletranslations”

“validationruleuseraccesses”

“validationruleusergroupaccesses”

Regards

Calle

···

Morten Olav Hansen

Senior Engineer, DHIS 2

Team Integration Lead

University of Oslo

http://www.dhis2.org

On Tue, Aug 7, 2018 at 5:07 PM, Em Le Hong em.hispvietnam@gmail.com wrote:

Dear all,

DHIS 2.29

I try to delete a validation rule on my database but the system response a message:

Could not delete due to association with another object: ValidationResult

This mean we need to delete Validation Result before delete Validation Rule

Does anyone know how to delete Validation Result, if you don’t mind please share.

Thanks,

Em Le Hong
DHIS2 Implementation| **HISP Vietnam **

em.hispvietnam@gmail.com | Skype: em.hispvietnam@gmail.com


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Hi,

I agree with Calle Hedberg that the system should automatically delete any dependent records related to validation rules.

In DHIS2, this kind of issue is not only happen with Validation rules, but also with many other objects.

For example to delete a data element, we need to delete its data value and audit trail. DHIS2 already provided API to delete data value and audit trail

/api/26/maintenance/dataPruning/dataElement/

I hope DHIS2 will support to delete validation rules and other objects soon.

···

Morten Olav Hansen

Senior Engineer, DHIS 2

Team Integration Lead

University of Oslo

http://www.dhis2.org

On Tue, Aug 7, 2018 at 5:07 PM, Em Le Hong em.hispvietnam@gmail.com wrote:

Dear all,

DHIS 2.29

I try to delete a validation rule on my database but the system response a message:

Could not delete due to association with another object: ValidationResult

This mean we need to delete Validation Result before delete Validation Rule

Does anyone know how to delete Validation Result, if you don’t mind please share.

Thanks,

Em Le Hong
DHIS2 Implementation| **HISP Vietnam **

em.hispvietnam@gmail.com | Skype: em.hispvietnam@gmail.com


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Em Le Hong
DHIS2 Implementation| **HISP Vietnam **

em.hispvietnam@gmail.com | Skype: em.hispvietnam@gmail.com

Hi

I do NOT agree that it should be possible to delete data elements that have datavalue or tracker records - in such cases where there is real DATA, the user must assess and delete such DATA first or else leave the data element no longer in use (with its data) - we typically move such historical data elements to an “inactive” data set.

On the other hand, I have found many meta-data objects where deletion is being blocked due to (sometimes random) records in other meta-data tables - meta-data that clearly won’t be relevant any more (e.g. various tables called “…dimensionitems” is a typical example). It is also a huge problem that when e.g. data elements - even data elements with no actual data - at some stage were included in some favourite, deletion is blocked AND the error message says nothing about WHERE it is used. I always end up spending considerable time tracking those down in the back end and deleting them, before being able to delete the data element itself. Audit trails is another example of “process” data that no longer is useful when e.g. a data element is deleted.

Regards

Calle

···

Morten Olav Hansen

Senior Engineer, DHIS 2

Team Integration Lead

University of Oslo

http://www.dhis2.org

On Tue, Aug 7, 2018 at 5:07 PM, Em Le Hong em.hispvietnam@gmail.com wrote:

Dear all,

DHIS 2.29

I try to delete a validation rule on my database but the system response a message:

Could not delete due to association with another object: ValidationResult

This mean we need to delete Validation Result before delete Validation Rule

Does anyone know how to delete Validation Result, if you don’t mind please share.

Thanks,

Em Le Hong
DHIS2 Implementation| **HISP Vietnam **

em.hispvietnam@gmail.com | Skype: em.hispvietnam@gmail.com


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Hello, am using Version 2.31.8 and am still facing this issue. Was it resolved and from which version?
Thanks