← Back to team overview

dhis2-users team mailing list archive

Re: [Dhis2-devs] Dataset Assignation programmatically

 

Look at https://play.dhis2.org/demo/api/dataSets/lyLU2wR22tC
and you will see something like

<organisationUnits>
<organisationUnit id="bVZTNrnfn9G"/>
<organisationUnit id="TAN6Q7vjvuk"/>

So you can just add them there and post the entire payload back. This is
probably the easiest way.

You can also add them one at a time by POSTing
to api/dataSets/A/organisationUnits/B
where A is the dataset UID and B is the organisation unit UID.

You can also insert them directly into the table "datasetsource" with SQL.
You will need to clear your server cache after this for the changes to
become visible.

Regards,
Jaosn



On Fri, Aug 5, 2016 at 11:38 AM, Knut Staring <knutst@xxxxxxxxx> wrote:

> The best way would be through the Web API.
>
> I think directly in the db might work (you can test it on a copy of your
> db).  You will have to clear the server cache or restart.
>
> You should also consider an upgrade, as you are a lot of versions behind
> now...
>
> Knut
>
> On Fri, Aug 5, 2016 at 11:35 AM, Raminosoa Rabemanantsoa, Tantely <
> traminosoa@xxxxxxxxxx> wrote:
>
>> Dear All,
>>
>> I would like to ask if someone has already experinced a batch assignation
>> of dataset to organization units directly in DHIS2 database? I have 10
>> datasets to assign to a thousands of orguints (which  will vary in time)
>> and it will be time consuming if using the Data Set Assignment Editor
>> manually. Your suggestions are welcome.
>>
>> I am using DHIS2 2.19.
>>
>> Thank you for your support.
>>
>> Regards,
>>
>> Tantely.
>>
>> *This message and its attachments are confidential and solely for the
>> intended recipients. If received in error, please delete them and notify
>> the sender via reply e-mail immediately.*
>> _______________________________________________
>> 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
>>
>>
>
>
> --
> Knut Staring
> Dept. of Informatics, University of Oslo
> Norway: +4791880522
> Skype: knutstar
> http://dhis2.org
>
> _______________________________________________
> 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
>
>


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

Follow ups

References