← Back to team overview

dhis2-users team mailing list archive

Re: Is there some way to filter datavalue by more than one organization group ?

 

Not sure how easy this would be through the WebAPI. I would  probably
tend opt  to create an SQL view and get the data this way through the
API. Maybe something like

SELECT * FROM datavalue where sourceid in (SELECT DISTINCT
organisationunitid from orgunitgroupmembers where
orgunitgroupiorgunitgrp1.id d  = )
AND sourceid IN  (SELECT DISTINCT organisationunitid from
orgunitgroupmembers where orgunitgroupid  = orgunitgrp2.id )

where orgunitgrp1.id  and orgunitgrp2.id  would correspond to the IDs
of the orgunit groups.

Of course, you might need to adjust the query just a bit if you wanted
aggregated data values, indicators, and you would probably need to
filter on certain periodicites of course.

The result set could then be retrieved through the WebAPI as described here.

http://dhis2.org/doc/snapshot/en/user/html/ch23s16.html

Regards,
Jason


On Mon, Sep 24, 2012 at 6:05 AM, easy <lin_xd@xxxxxxx> wrote:
> Thanks for your quick answer.
> My mean is:  for example: we have defined  two orggrp1(
> org1,org2,org3,org4,org5) ,orggrp2(org3,org4,org5,org6), I want only get the
> dataelement and indiator values  of (orggrp1) ∩ (orggrp2) ={
> org3,org4,org5}. not
>
>  (orggrp1) ∪ (orggrp2) ={ org1,org2,org3,org4,org5,org6}
>
>
>
>
>
> --
> 此致
>
>    林晓东
>
> 莫愁前路无知己,天下谁人不识君。
>
>
> At 2012-09-24 11:49:20,"Jason Pickering" <jason.p.pickering@xxxxxxxxx>
> wrote:
>>Hi Easy,
>>
>>Nice that you have translated it to Chinese.
>>
>>In regards to your other query, I think you can do this by something
>>like this (login with admin/district)
>>
>>1) Gettting all orgunits in a particular group
>>
>>e.g. http://apps.dhis2.org/dev/api/organisationUnitGroups/RXL3lPSK8oG.xml
>>
>>2) You can get the datasets which the orgunit belongs to
>>
>>e.g. http://apps.dhis2.org/dev/api/organisationUnits/GvFqTavdpGE.xml
>>
>>3) Each dataset is associated with data elements
>>
>>e.g http://apps.dhis2.org/dev/api/dataSets/lyLU2wR22tC.xml
>>
>>If I understood you correctly, this should provide a path to get data
>>elements for each orgunit in different groups.
>>
>>Regards,
>>Jason
>>
>>
>>On Mon, Sep 24, 2012 at 5:26 AM, easy <lin_xd@xxxxxxx> wrote:
>>> Hi,Knut,
>>>   I have translated DHIS2 to chinese. glad to contribute.
>>>   I hope provide the dataelement  of the org belong to grp1 and grp2 with
>>> webapi,is there a way do it ?
>>>
>>>
>>> --
>>> 此致
>>>
>>>    林晓东
>>>
>>> 莫愁前路无知己,天下谁人不识君。
>>> At 2012-09-23 17:01:25,"Knut Staring" <knutst@xxxxxxxxx> wrote:
>>>
>>> Hello Easy, have you translated DHIS2 to Chinese? It would be great if
>>> you
>>> could contribute back.
>>>
>>> Best regards,
>>> Knut
>>>
>>> Sent from my mobile
>>>
>>> On Sep 23, 2012 9:00 AM, "easy" <lin_xd@xxxxxxx> wrote:
>>>>
>>>> Hello,
>>>> I want get data element value by filter by org group,but I find there
>>>> only
>>>> filter one org group in dhis2, I want to know how to filter with more
>>>> group
>>>> (org is the interset of grp1 ,grp2,...)
>>>> also there isn't filter by groupset?
>>>> --
>>>> 此致
>>>>
>>>> easy
>>>>
>>>> 莫愁前路无知己,天下谁人不识君。
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>
>
>


References