← Back to team overview

dhis2-users team mailing list archive

Re: Script to disassociate Orgunit with Datavalue

 

Thank you. That works great.



*Walusiku J. Muyunda*


*Cell: +260967006614Cell: +260971000614*
*Cell: +260953063387*

*"We have heaven to win and hell to shun, our lives testify better!"
<http://wildvoices.blogspot.com/>*


On Thu, Oct 11, 2018 at 4:11 PM Jason Pickering <jason.p.pickering@xxxxxxxxx>
wrote:

> Just load the script in your database and execute it with
>
> SELECT * FROM delete_site_with_data('tPR9B5xETb');
>
> Regards,
> Jason
>
> On Thu, Oct 11, 2018 at 4:08 PM Walusiku Muyunda <jomuwalu@xxxxxxxxx>
> wrote:
>
>> Hi Jason,
>>
>> Please help with syntax for this line:
>> EXECUTE 'SELECT organisationunitid from organisationunit where uid =
>> 'tPR9B5xETb'''' ||   $1  || ''''  INTO organisationunitid; Is this where I
>> need to specify the uid?
>>
>> Thanks.
>>
>> *Walusiku J. Muyunda*
>>
>>
>> *Cell: +260967006614Cell: +260971000614*
>> *Cell: +260953063387*
>>
>> *"We have heaven to win and hell to shun, our lives testify better!"
>> <http://wildvoices.blogspot.com/>*
>>
>>
>> On Thu, Oct 11, 2018 at 1:10 PM Walusiku Muyunda <jomuwalu@xxxxxxxxx>
>> wrote:
>>
>>> Thank you Jason, this will be very helpful. Am using v2.28 and hope the
>>> script will run without complaints.
>>>
>>> Regards.
>>>
>>>
>>> *Walusiku J. Muyunda*
>>>
>>>
>>> *Cell: +260967006614Cell: +260971000614*
>>> *Cell: +260953063387*
>>>
>>> *"We have heaven to win and hell to shun, our lives testify better!"
>>> <http://wildvoices.blogspot.com/>*
>>>
>>>
>>> On Thu, Oct 11, 2018 at 12:12 PM Jason Pickering <
>>> jason.p.pickering@xxxxxxxxx> wrote:
>>>
>>>> Hi there!
>>>>
>>>> You can have a look here
>>>> https://github.com/dhis2/dhis2-utils/blob/master/resources/sql/delete_orgunit_with_data.sql
>>>>
>>>> which will delete the site and all object associated with it. You
>>>> should supply the UID of the orgunit you wish to delete as a paramater to
>>>> the Postgresql function.
>>>>
>>>> You may also need to update the script to suit the version of DHIS2 you
>>>> are running.
>>>>
>>>> As usual, be sure to test this on a development database first!
>>>>
>>>> Best regards,
>>>> Jason
>>>>
>>>>
>>>> On Thu, Oct 11, 2018 at 10:49 AM Walusiku Muyunda <jomuwalu@xxxxxxxxx>
>>>> wrote:
>>>>
>>>>> Dear All,
>>>>>
>>>>> Is there there anyone with a script to disassociate an Orgunit from
>>>>> all associated programs or data sets so I can be able to delete it from
>>>>> within DHIS2?
>>>>>
>>>>> Thank you.
>>>>>
>>>>>
>>>>>
>>>>> *Walusiku J. Muyunda*
>>>>>
>>>>>
>>>>> *Cell: +260967006614Cell: +260971000614*
>>>>> *Cell: +260953063387*
>>>>>
>>>>> *"We have heaven to win and hell to shun, our lives testify better!"
>>>>> <http://wildvoices.blogspot.com/>*
>>>>> _______________________________________________
>>>>> 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
>>>>
>>>
>
> --
> Jason P. Pickering
> email: jason.p.pickering@xxxxxxxxx
> tel:+46764147049
>

References