← Back to team overview

dhis2-users team mailing list archive

Re: Can't delete some data elements

 

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@xxxxxxxxxxxxxxxxxxx/

On Wed, Apr 25, 2018 at 12:24 PM, Isaiah Nyabuto <isaiahnyabuto@xxxxxxxxx>
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@xxxxxx> 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@xxxxxx
>> 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@xxxxxx
>>
>> 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@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-users
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
> _______________________________________________
> 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
>
>


-- 
Jason P. Pickering
email: jason.p.pickering@xxxxxxxxx
tel:+46764147049

Follow ups

References