Can't delete some data elements

Hi,

I am actually testing DHIS2 live, so I’ve builded a data set including several data elements. I also tested Data Entry.

But when I want to delete some data elements I have this message : “Could not delete due to association with another object: DataValue”.

What should I do be able to delete all data elements, and to start from the beginning with the real project?

I am sorry if this question was asked before, but I can’t find how to reach all forum conversations.

Thank you.

Kind regards.

Aljosa

Hello Aljosa,

The error indicates that the elements in question have already got some values submitted using them and as such deleting them will cause some violations.

If you must delete, you need to find the values and delete them First.

Regards

···

On Wed, Apr 25, 2018, 10:59 AM Aljosa Celebic Aljosa.Celebic@lih.lu wrote:

Hi,

I am actually testing DHIS2 live, so I’ve builded a data set including several data elements. I also tested Data Entry.

But when I want to delete some data elements I have this message : “Could not delete due to association with another object: DataValue”.

What should I do be able to delete all data elements, and to start from the beginning with the real project?

I am sorry if this question was asked before, but I can’t find how to reach all forum conversations.

Thank you.

Kind regards.

Aljosa

Aljosa Celebic

Data Manager, Competence Center for Methodology and Statistics

Luxembourg Institute of Health

Department of Population Health

1A-B, rue Thomas Edison, L-1445 Strassen

Luxembourg

Tel: +352 26970-399

Fax: +352 26970-719

Email: aljosa.celebic@lih.lu

Website: https://www.lih.lu/

Join us on Facebook and follow our activities on Twitter:

https://www.facebook.com/Luxembourg.Institute.of.Health

http://twitter.com/LIH_Luxembourg

aljosa.celebic@lih.lu

This message (including any attachments) is intended for the addressee only and may contain confidential and/or privileged information and/or information protected by intellectual property rights. If you have received this message by mistake, please notify the sender by return e-mail and delete this message from your system. You should not use, alter, copy or distribute this message or disclose its contents to anyone. E-mail transmission can not be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. Luxembourg Institute of Health shall not be responsible nor liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt or damage to your system.


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

Hello Aljosa,

To add on Barnabas’ comment, also check that the data elements don’t have category combinations. Because you will need to delete the m first.

Regards

Bridget

image

···

From: Dhis2-users [mailto:dhis2-users-bounces+bridgetmagoba=mifumi.org@lists.launchpad.net] On Behalf Of Barnabas Akumba
Sent: Wednesday, April 25, 2018 1:07 PM
To: Aljosa Celebic
Cc: dhis2-users
Subject: Re: [Dhis2-users] Can’t delete some data elements

Hello Aljosa,

The error indicates that the elements in question have already got some values submitted using them and as such deleting them will cause some violations.

If you must delete, you need to find the values and delete them First.

Regards

On Wed, Apr 25, 2018, 10:59 AM Aljosa Celebic Aljosa.Celebic@lih.lu wrote:

Hi,

I am actually testing DHIS2 live, so I’ve builded a data set including several data elements. I also tested Data Entry.

But when I want to delete some data elements I have this message : “Could not delete due to association with another object: DataValue”.

What should I do be able to delete all data elements, and to start from the beginning with the real project?

I am sorry if this question was asked before, but I can’t find how to reach all forum conversations.

Thank you.

Kind regards.

Aljosa

Aljosa Celebic
Data Manager, Competence Center for Methodology and Statistics

Luxembourg Institute of Health
Department of Population Health
1A-B, rue Thomas Edison, L-1445 Strassen
Luxembourg
Tel: +352 26970-399
Fax: +352 26970-719
Email: aljosa.celebic@lih.lu
Website: https://www.lih.lu/

Image removed by sender.

Join us on Facebook and follow our activities on Twitter:
https://www.facebook.com/Luxembourg.Institute.of.Health
http://twitter.com/LIH_Luxembourg
aljosa.celebic@lih.lu

This message (including any attachments) is intended for the addressee only and may contain confidential and/or privileged information and/or information protected by intellectual property rights. If you have received this message by mistake, please notify the sender by return e-mail and delete this message from your system. You should not use, alter, copy or distribute this message or disclose its contents to anyone. E-mail transmission can not be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. Luxembourg Institute of Health shall not be responsible nor liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt or damage to your system.


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


Virus-free. www.avast.com

Hi Aljosa,

You cannot directly delete data elements that are already assigned to other objects due to some dependencies.

Please try to unassigned the data elements from the dataset and ensure that there there is no other dependencies before deleting. - This should work.

All the best!

···

On Apr 25, 2018 12:59, “Aljosa Celebic” Aljosa.Celebic@lih.lu wrote:

Hi,

I am actually testing DHIS2 live, so I’ve builded a data set including several data elements. I also tested Data Entry.

But when I want to delete some data elements I have this message : “Could not delete due to association with another object: DataValue”.

What should I do be able to delete all data elements, and to start from the beginning with the real project?

I am sorry if this question was asked before, but I can’t find how to reach all forum conversations.

Thank you.

Kind regards.

Aljosa

Aljosa Celebic

Data Manager, Competence Center for Methodology and Statistics

Luxembourg Institute of Health

Department of Population Health

1A-B, rue Thomas Edison, L-1445 Strassen

Luxembourg

Tel: +352 26970-399

Fax: +352 26970-719

Email: aljosa.celebic@lih.lu

Website: https://www.lih.lu/

Join us on Facebook and follow our activities on Twitter:

https://www.facebook.com/Luxembourg.Institute.of.Health

http://twitter.com/LIH_Luxembourg

aljosa.celebic@lih.lu

This message (including any attachments) is intended for the addressee only and may contain confidential and/or privileged information and/or information protected by intellectual property rights. If you have received this message by mistake, please notify the sender by return e-mail and delete this message from your system. You should not use, alter, copy or distribute this message or disclose its contents to anyone. E-mail transmission can not be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. Luxembourg Institute of Health shall not be responsible nor liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt or damage to your system.


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 Aljosa,

Based on the message you are seeing and as was pointed out before, you have data which is associated with the data element. The system will thus not allow you to delete the data element, when there is still data associated with the data element. You could delete the data manually (if you have a small amount) but if you need to delete large amounts of data, this may not be practical.

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.

Please be aware that this will permanently remove the data from the database, so be sure you have a backup copy first before you perform this operation.

Regards,

Jason

P.S. You can search the mail archives here https://www.mail-archive.com/dhis2-devs@lists.launchpad.net/

···

On Wed, Apr 25, 2018 at 12:24 PM, Isaiah Nyabuto isaiahnyabuto@gmail.com wrote:

Hi Aljosa,

You cannot directly delete data elements that are already assigned to other objects due to some dependencies.

Please try to unassigned the data elements from the dataset and ensure that there there is no other dependencies before deleting. - This should work.

All the best!

==========================
Isaiah Nyabuto
+254729572616
Bsc. Health Records Management and Informatics


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

On Apr 25, 2018 12:59, “Aljosa Celebic” Aljosa.Celebic@lih.lu wrote:

Hi,

I am actually testing DHIS2 live, so I’ve builded a data set including several data elements. I also tested Data Entry.

But when I want to delete some data elements I have this message : “Could not delete due to association with another object: DataValue”.

What should I do be able to delete all data elements, and to start from the beginning with the real project?

I am sorry if this question was asked before, but I can’t find how to reach all forum conversations.

Thank you.

Kind regards.

Aljosa

Aljosa Celebic

Data Manager, Competence Center for Methodology and Statistics

Luxembourg Institute of Health

Department of Population Health

1A-B, rue Thomas Edison, L-1445 Strassen

Luxembourg

Tel: +352 26970-399

Fax: +352 26970-719

Email: aljosa.celebic@lih.lu

Website: https://www.lih.lu/

Join us on Facebook and follow our activities on Twitter:

https://www.facebook.com/Luxembourg.Institute.of.Health

http://twitter.com/LIH_Luxembourg

aljosa.celebic@lih.lu

This message (including any attachments) is intended for the addressee only and may contain confidential and/or privileged information and/or information protected by intellectual property rights. If you have received this message by mistake, please notify the sender by return e-mail and delete this message from your system. You should not use, alter, copy or distribute this message or disclose its contents to anyone. E-mail transmission can not be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. Luxembourg Institute of Health shall not be responsible nor liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt or damage to your system.


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

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

1 Like

Thank you for answering me.

I first tried to delete some data manually.

Then I delete some categories, datasets.

Now I don’t have datasets, I realized that I can’t even access to the data to delete it manually.

I still have 5 category options, 2 category combinations and 10 data elements that I cannot delete.

I would like to try Jason’s method.

Where can I find uid for each data element?

And where can I execute SQL command? My profile is ‘superuser’.

Thank you for your help.

Kind regards.

Aljosa

···

Hi Aljosa,

Based on the message you are seeing and as was pointed out before, you have data which is associated with the data element. The system will thus not allow you to delete the data element, when there is still data associated with the data element. You could delete the data manually (if you have a small amount) but if you need to delete large amounts of data, this may not be practical.

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.

Please be aware that this will permanently remove the data from the database, so be sure you have a backup copy first before you perform this operation.

Regards,

Jason

P.S. You can search the mail archives here https://www.mail-archive.com/dhis2-devs@lists.launchpad.net/

On Wed, Apr 25, 2018 at 12:24 PM, Isaiah Nyabuto isaiahnyabuto@gmail.com wrote:

Hi Aljosa,

You cannot directly delete data elements that are already assigned to other objects due to some dependencies.

Please try to unassigned the data elements from the dataset and ensure that there there is no other dependencies before deleting. - This should work.

All the best!

==========================

Isaiah Nyabuto

+254729572616

Bsc. Health Records Management and Informatics

On Apr 25, 2018 12:59, “Aljosa Celebic” Aljosa.Celebic@lih.lu wrote:

Hi,

I am actually testing DHIS2 live, so I’ve builded a data set including several data elements. I also tested Data Entry.

But when I want to delete some data elements I have this message : “Could not delete due to association with another object: DataValue”.

What should I do be able to delete all data elements, and to start from the beginning with the real project?

I am sorry if this question was asked before, but I can’t find how to reach all forum conversations.

Thank you.

Kind regards.

Aljosa

Aljosa Celebic

Data Manager, Competence Center for Methodology and Statistics

Luxembourg Institute of Health

Department of Population Health

1A-B, rue Thomas Edison, L-1445 Strassen

Luxembourg

Tel: +352 26970-399

Fax: +352 26970-719

Email: aljosa.celebic@lih.lu

Website:
https://www.lih.lu/

Join us on Facebook and follow our activities on Twitter:

https://www.facebook.com/Luxembourg.Institute.of.Health

http://twitter.com/LIH_Luxembourg

aljosa.celebic@lih.lu

This message (including any attachments) is intended for the addressee only and may contain confidential and/or privileged information and/or information protected by intellectual property rights. If you have received this message by mistake, please notify the sender by return e-mail and delete this message from your system. You should not use, alter, copy or distribute this message or disclose its contents to anyone. E-mail transmission can not be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. Luxembourg Institute of Health shall not be responsible nor liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt or damage to your system.


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

Jason P. Pickering

email: jason.p.pickering@gmail.com

tel:+46764147049