← Back to team overview

dhis2-devs team mailing list archive

Re: [Dhis2-users] Delete Validation Rules

 

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/<data-element-uid>*

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

On Wed, Aug 8, 2018 at 7:47 PM Calle Hedberg <calle.hedberg@xxxxxxxxx>
wrote:

> 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
>
> On Wed, 8 Aug 2018 at 07:03, Morten Olav Hansen <morten@xxxxxxxxx> wrote:
>
>> 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
>>
>> --
>> 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@xxxxxxxxx>
>> 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@xxxxxxxxx | *Skype:* em.hispvietnam@xxxxxxxxx
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-users
>>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> 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@xxxxxxxxx
>
> Skype: calle_hedberg
>
> *******************************************
>
>

-- 
*Em Le Hong*
DHIS2 Implementation| *HISP Vietnam *
em.hispvietnam@xxxxxxxxx | *Skype:* em.hispvietnam@xxxxxxxxx

Follow ups

References