Thanks Jason, I will use dataelements to perform it.

Many regards,
Joao
From: Jason Pickering [mailto:[email protected]]
Sent: 26 March 2015 15:18
To: Joao Mazuze
Cc: [email protected]
Subject: Re: [Dhis2-users] Eliminating data

Hi Joao,


Your original mail said this..

>Is there any script which allows us deleting for any specific orgunit on a 
>given period?

So, that  sample query which I provided will delete all data for a specific 
orgunit and a given period. i.e. all data elements for a given period for a 
single orgunit. If you need specific data elements, then it might be something 
like

DELETE FROM datavalue where sourceid = X and periodid = Y and dataelementid IN 
(A,B,C,D);

where A,B,C,D correspond to the data elements which you want to actually delete.


 If there are more restrictions, you will just have to develop an SQL query 
which fits you needs.

There is no linkage of datavalues to data sets, only to data elements. Just 
follow the foreign key constraints in the datavalue table, and it will make 
things a bit more clear.

If you need more help, just provide more detail, and we can try and help out.

Regards,
Jason


On Thu, Mar 26, 2015 at 8:50 AM, Joao Mazuze 
<[email protected]<mailto:[email protected]>> wrote:
Hi Jason,
I think I will need also to specify the dataset as I don´t want to delete data  
in all the datasets.

Kind regards

From: Jason Pickering 
[mailto:[email protected]<mailto:[email protected]>]
Sent: 26 March 2015 13:52
To: Joao Mazuze
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [Dhis2-users] Eliminating data

Hi Joao,

It depends on your exact needs, but take a look at the "datavalue" table.

Something like

DELETE FROM datavalue where sourceid = X and periodid = Y;

X should be replaced by the organisationunitid from the organisationunit table 
for the orgunit you want.

Y should be replaced by the particular periodid found in the period table.

Obviously, you should make a backup of your database before attempting such an 
operation.

Regards,
Jason


On Thu, Mar 26, 2015 at 5:51 AM, Joao Mazuze 
<[email protected]<mailto:[email protected]>> wrote:
Hi all,
Is there any script which allows us deleting for any specific orgunit on a 
given period?

Best regards,


_____________________________________
João Gabriel Mazuze
National Database Manager
Projecto CHASS-SMT
Abt Associates Inc.
Av. Marginal, 4067
Cidade de Maputo, Moçambique
Fax: (+ 258)  21486767<tel:%28%2B%20258%29%C2%A0%2021486767>
Tel:  (+ 258)  21493525<tel:%28%2B%20258%29%C2%A0%2021493525>/6/8
Cell: (+258) 82 4236279<tel:%28%2B258%29%2082%204236279>
www.chasssmt.com<http://www.chasssmt.com/>

[Description: Description: Description: Description: Description: Description: 
Description: Description: Description: Logotipo CHASS-SMT]
Somos um projecto financiado  pelo PEPFAR-II, através da USAID, para reforçar o 
Sistema de Saúde das Provincias de  Sofala, Manica e Tete. Pretendemos melhorar 
a ligação e integração do HIV  com os Cuidados Primários de Saúde e outros a 
ele relacionados em coordenação com as Direcções Provinciais de Saúde e outros 
parceiros. Através do projecto CHASS-SMT, o Governo Americano apoia o Governo 
Moçambicano na melhoria da qualidade dos Serviços de Saúde no país.



________________________________
This message may contain privileged and confidential information intended 
solely for the addressee. Please do not read, disseminate or copy it unless you 
are the intended recipient. If this message has been received in error, we 
kindly ask that you notify the sender immediately by return email and delete 
all copies of the message from your system.

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to     : 
[email protected]<mailto:[email protected]>
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp



--
Jason P. Pickering
email: [email protected]<mailto:[email protected]>
tel:+46764147049

________________________________
This message may contain privileged and confidential information intended 
solely for the addressee. Please do not read, disseminate or copy it unless you 
are the intended recipient. If this message has been received in error, we 
kindly ask that you notify the sender immediately by return email and delete 
all copies of the message from your system.



--
Jason P. Pickering
email: [email protected]<mailto:[email protected]>
tel:+46764147049


________________________________
This message may contain privileged and confidential information intended 
solely for the addressee. Please do not read, disseminate or copy it unless you 
are the intended recipient. If this message has been received in error, we 
kindly ask that you notify the sender immediately by return email and delete 
all copies of the message from your system.
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to