← Back to team overview

dhis2-users team mailing list archive

Re: [Dhis2-devs] Removing Organization Units

 

Gerald you would need to do this with an sql delete command.  Before
you do you should be 100% sure that you do really want to delete the
data - maybe make a backup first.

You need to find the primary key (organisationunitid) of the orgunit
you want to delete.  Say it is 5677 Then:

DELETE FROM datavalue where sourceid like 5677;

If you have a few then something like:

-- examples only!
DELETE FROM datavalue where sourceid in (5677, 5674, 3456);

If you have many then put them in a temporary orgunit group and make a
fancier query.

Note you might still get the odd error when deleting the orgunit if
your orgunits are being used in charts and the like.  You'll have to
address these one at a time.

On 1 October 2015 at 17:39, gerald thomas <gerald17006@xxxxxxxxx> wrote:
> Dear Dapo,
> What is the command to remove those data from the database as per
> organisation unit?
> Please help me.
>
> Regards,
> Gerald
>
> On Oct 1, 2015 16:16, "Dapo Adejumo" <dapsyjorge@xxxxxxxxx> wrote:
>>
>> Hi Gerald,
>> What error are you getting?
>> If you have data associated with these org units, you will not be able to
>> remove them until you delete the data in the database (even if you have
>> removed the datasets).
>>
>> ………………………………………
>> Regards,
>> Dapo Adejumo
>> +2348033683677
>> Skype : dapojorge
>>
>> ----- Original Message -----
>> From: "gerald thomas" <gerald17006@xxxxxxxxx>
>> To: "dhis2-users" <dhis2-users@xxxxxxxxxxxxxxxxxxx>, "dhis2-devs"
>> <dhis2-devs@xxxxxxxxxxxxxxxxxxx>
>> Sent: Thursday, October 1, 2015 5:10:25 PM
>> Subject: [Dhis2-devs] Removing Organization Units
>>
>> Dear All,
>> I am trying to remove Organisation Units from DHIS2 versions 2.18 and
>> 2.20 but i am getting error.
>>
>> But i had already removed the datasets associated with these
>> Organisation Units but i still can't remove them.
>>
>> Please can someone help.
>>
>> --
>> Regards,
>>
>> Gerald
>>
>> _______________________________________________
>> 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
>
>
> _______________________________________________
> 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
>


Follow ups

References