Re: [Dhis2-users] [Dhis2-devs] SQL query for DataSets

2017-02-21 Thread Raminosoa Rabemanantsoa, Tantely
Hi Greg, Tim, Thank you for sharing the alternative way using API. Is it possible to go backward using the API, if I would like to go beyound getting the list of assigned dataSets and this time assign a set of dataSets to a group of OU? That will also be helpful! Kind Regards, Tantely On Tue, F

Re: [Dhis2-users] [Dhis2-devs] SQL query for DataSets

2017-02-21 Thread Raminosoa Rabemanantsoa, Tantely
Thank you Ant, that is straightforward! We need that sometimes to counter check all things. Regards, Tantely. On Wed, Feb 22, 2017 at 7:16 AM, Ant Snyman wrote: > and if you also want the datasets that are NOT assigned to ANY > orgunits you could change the two JOINs to LEFT OUTER JOIN...

Re: [Dhis2-users] [Dhis2-devs] SQL query for DataSets

2017-02-21 Thread Raminosoa Rabemanantsoa, Tantely
Dear Jim, I have tested both scripts and they are all working. The second one is more straightforward for the analyzes that I will run with external list. Thank you for your support! Regards, Tantely. Le 21 févr. 2017 9:32 PM, "Jim Grace" a écrit : > If you want to show each pair of assigned

Re: [Dhis2-users] [Dhis2-devs] SQL query for DataSets

2017-02-21 Thread Ant Snyman
and if you also want the datasets that are NOT assigned to ANY orgunits you could change the two JOINs to LEFT OUTER JOIN. On 21 February 2017 at 20:31, Jim Grace wrote: > If you want to show each pair of assigned orgUnit and dataSet, try > something like: > > SELECT ou.name AS orgunit,

Re: [Dhis2-users] [Dhis2-devs] SQL query for DataSets

2017-02-21 Thread Greg Wilson
And to tag onto Tim's message, if you know the particular OU of interest, you can all datasets associated with it via: https://play.dhis2.org/demo/api/dataSet?filter=organisationUnits.id:eq:THEOUUIDGOESHERE Greg On Tue, Feb 21, 2017 at 1:41 PM, Timothy Harding wrote: > An alternative way to d

Re: [Dhis2-users] [Dhis2-devs] SQL query for DataSets

2017-02-21 Thread Jim Grace
If you want to show each pair of assigned orgUnit and dataSet, try something like: SELECT ou.name AS orgunit, ds.name AS dataset FROM dataset ds JOIN datasetsource dss ON dss.datasetid = ds.datasetid JOIN organisationunit ou ON ou.organisationunitid = dss.sourceid ORDER BY ou.name, ds.name; If yo