Deleting old data elements

Dear all,

I am trying to delete some old dataelements. Previously I have deleted, using SQL delete sentences, all datavalues associated to them. Everything goes well, but still some data elements don’t want to disappear. I mean, when I click on the Remove button (web interface):

  1. Some times appear the message “Deleting …”, but nothing really happens.

or

  1. Other times appear the following message: “Object not deleted because it is associated by object of type”

Any ideas about 1) or 2)? I am using DHIS 2.12 and postgresql

Thanks!

Jose

Hi Jose,

If you try deleting those elements from PGAdmin, the error message will include the object/table to which the data element is associated. You should then delete that association and try deleting the data element again. You could also follow what is happening in your tomcat window when you press delete. This will also let you know the data element cannot be deleted because it is referenced in another table like an org unit group.

Hope this helps.

Regards

Busoye

···

On 28 Aug 2013, at 00:41, Jose Garcia Muñoz <josemp10@gmail.com> wrote:

Dear all,

I am trying to delete some old dataelements. Previously I have deleted, using SQL delete sentences, all datavalues associated to them. Everything goes well, but still some data elements don't want to disappear. I mean, when I click on the Remove button (web interface):

1) Some times appear the message "Deleting ....", but nothing really happens.

or

2) Other times appear the following message: "Object not deleted because it is associated by object of type"

Any ideas about 1) or 2)? I am using DHIS 2.12 and postgresql

Thanks!
Jose
_______________________________________________
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

Busoye is right. You need to make sure that the data elements are deleted from all the tables where they may appear (below is a list of most of them):

Dataelementaggregationlevels
Dataelementaggributevalues
dataelementgroupmembers
dataelementoperand
datasetmembers
datavalue
datavalue_audit
datavaluearchive

** if you use the patient tracker module
patientaggregatereport
patientdatavalue
patientdatavaluearchive
programstage_dataelements

reporttable_dataelements
sectiondataelements
sectiongreyedfields
  
** if you use the SMS module
smscodes

** if you did translations of your data elements
translation

You might want to create a script that deletes the specific dataelementids in each table before deleting from the dataelement table.

Randy

···

-----Original Message-----
From: Dhis2-users [mailto:dhis2-users-bounces+rwilson=msh.org@lists.launchpad.net] On Behalf Of Adebusoye Anifalaje
Sent: Wednesday, August 28, 2013 9:10 AM
To: Jose Garcia Muñoz
Cc: dhis2-users@lists.launchpad.net
Subject: Re: [Dhis2-users] Deleting old data elements

Hi Jose,

If you try deleting those elements from PGAdmin, the error message will include the object/table to which the data element is associated. You should then delete that association and try deleting the data element again. You could also follow what is happening in your tomcat window when you press delete. This will also let you know the data element cannot be deleted because it is referenced in another table like an org unit group.

Hope this helps.

Regards

Busoye

On 28 Aug 2013, at 00:41, Jose Garcia Muñoz <josemp10@gmail.com> wrote:

Dear all,

I am trying to delete some old dataelements. Previously I have deleted, using SQL delete sentences, all datavalues associated to them. Everything goes well, but still some data elements don't want to disappear. I mean, when I click on the Remove button (web interface):

1) Some times appear the message "Deleting ....", but nothing really happens.

or

2) Other times appear the following message: "Object not deleted because it is associated by object of type"

Any ideas about 1) or 2)? I am using DHIS 2.12 and postgresql

Thanks!
Jose
_______________________________________________
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

_______________________________________________
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

Many thanks Randy, Adebusoye… will try to do that. And yes, a script will be very useful. Thanks for your comments.

jose

···

On Wed, Aug 28, 2013 at 11:07 AM, Wilson,Randy rwilson@msh.org wrote:

Busoye is right. You need to make sure that the data elements are deleted from all the tables where they may appear (below is a list of most of them):

Dataelementaggregationlevels

Dataelementaggributevalues

dataelementgroupmembers

dataelementoperand

datasetmembers

datavalue

datavalue_audit

datavaluearchive

** if you use the patient tracker module

patientaggregatereport

patientdatavalue

patientdatavaluearchive

programstage_dataelements

reporttable_dataelements

sectiondataelements

sectiongreyedfields

** if you use the SMS module

smscodes

** if you did translations of your data elements

translation

You might want to create a script that deletes the specific dataelementids in each table before deleting from the dataelement table.

Randy

-----Original Message-----

From: Dhis2-users [mailto:dhis2-users-bounces+rwilson=msh.org@lists.launchpad.net] On Behalf Of Adebusoye Anifalaje

Sent: Wednesday, August 28, 2013 9:10 AM

To: Jose Garcia Muñoz

Cc: dhis2-users@lists.launchpad.net

Subject: Re: [Dhis2-users] Deleting old data elements

Hi Jose,

If you try deleting those elements from PGAdmin, the error message will include the object/table to which the data element is associated. You should then delete that association and try deleting the data element again. You could also follow what is happening in your tomcat window when you press delete. This will also let you know the data element cannot be deleted because it is referenced in another table like an org unit group.

Hope this helps.

Regards

Busoye

On 28 Aug 2013, at 00:41, Jose Garcia Muñoz josemp10@gmail.com wrote:

Dear all,

I am trying to delete some old dataelements. Previously I have deleted, using SQL delete sentences, all datavalues associated to them. Everything goes well, but still some data elements don’t want to disappear. I mean, when I click on the Remove button (web interface):

  1. Some times appear the message “Deleting …”, but nothing really happens.

or

  1. Other times appear the following message: “Object not deleted because it is associated by object of type”

Any ideas about 1) or 2)? I am using DHIS 2.12 and postgresql

Thanks!

Jose


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


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

Hi Jose,

the recommendations given about SQL statements are correct, however this is probably a bug with deletion in DHIS which should be fixed. Could you please share the output in your Tomcat / server container log appearing after you delete those data elements?

regards,

Lars

···

On Wed, Aug 28, 2013 at 12:41 AM, Jose Garcia Muñoz josemp10@gmail.com wrote:

Dear all,

I am trying to delete some old dataelements. Previously I have deleted, using SQL delete sentences, all datavalues associated to them. Everything goes well, but still some data elements don’t want to disappear. I mean, when I click on the Remove button (web interface):

  1. Some times appear the message “Deleting …”, but nothing really happens.

or

  1. Other times appear the following message: “Object not deleted because it is associated by object of type”

Any ideas about 1) or 2)? I am using DHIS 2.12 and postgresql

Thanks!

Jose


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