← Back to team overview

dhis2-devs team mailing list archive

Re: [Dhis2-users] WebAPI Bugs when filtering by level and ancestor

 

Many thanks for all of you,
I will just use the @Jason idea with path filter before to have a best way
to handle it.

Best

Diao

On Thu, Jul 27, 2017 at 8:26 AM, Jason Pickering <
jason.p.pickering@xxxxxxxxx> wrote:

> Seems to work as its documented (at least in some cases)
>
> https://play.dhis2.org/dev/api/dataElements?filter=name:like:IPT
>
> Gives all data elements which contain IPT
>
> https://play.dhis2.org/dev/api/dataElements?filter=name:
> like:IPT&filter=name:like:1st
>
> Gives all data elements which contain IPT and 1st (but no others).
>
> This however, does not work
>
> https://play.dhis2.org/dev/api/27/organisationUnits.json?
> filter=level:eq:4&filter=ancestors.id:eq:O6uvpzGd5pu&
> fields=id,name,ancestors,level
>
> as you get some level 3 and some level 4 units.
>
> This however does work
>
> https://play.dhis2.org/dev/api/27/organisationUnits.json?
> filter=level:eq:4&filter=path:like:O6uvpzGd5pu&fields=id,
> name,ancestors,level
>
>
> So, maybe the problem is filtering in the nested collections?
>
> /Jason
>
> On Thu, Jul 27, 2017 at 10:09 AM, Gaurav Kumar <gkumar@
> internationalmedicalcorps.org> wrote:
>
>> Hi Morten,
>>
>>
>>
>> Could this be linked to the issue I reported earlier?
>>
>>
>>
>> [image: Bug]DHIS2-1911 <https://jira.dhis2.org/browse/DHIS2-1911>(WEB
>> API: Recursive filtering not working with more than one AND filter).
>>
>>
>>
>> Regards,
>>
>> GAURAV
>>
>>
>>
>> *From:* Dhis2-devs [mailto:dhis2-devs-bounces+gkumar=
>> internationalmedicalcorps.org@xxxxxxxxxxxxxxxxxxx] *On Behalf Of *Morten
>> Olav Hansen
>> *Sent:* Thursday, July 27, 2017 7:16 AM
>> *To:* Mamadou Diao Diallo <diao_diallo@xxxxxxxxxx>
>> *Cc:* dhis2-users <dhis2-users@xxxxxxxxxxxxxxxxxxx>; DHIS 2 developers <
>> dhis2-devs@xxxxxxxxxxxxxxxxxxx>
>> *Subject:* Re: [Dhis2-devs] [Dhis2-users] WebAPI Bugs when filtering by
>> level and ancestor
>>
>>
>>
>> Hi Mamadou
>>
>>
>>
>> Could you please report a bug to JIRA? jira.dhis2.org
>>
>>
>> --
>>
>> Morten Olav Hansen
>>
>> Senior Engineer, DHIS 2
>>
>> University of Oslo
>>
>> http://www.dhis2.org
>>
>>
>>
>> On Wed, Jul 26, 2017 at 11:52 PM, Mamadou Diao Diallo <
>> diao_diallo@xxxxxxxxxx> wrote:
>>
>> Hi Devs,
>>
>> I'm currently using dhis2 API to develop an App, but I have some troubles
>> when I filter by *level* and *ancestor* in the same time.
>>
>>
>>
>> To clarify:
>>
>>
>>
>> *Everything is ok with this one :* URL/api/25/organisationUnits.j
>> son?filter=level:eq:'+level+'&fields=[id,displayName]
>>
>>
>>
>> *But by adding ancestor parameter the level is just ignored:*
>>
>> URL/api/25/organisationUnits.json?filter=level:eq:'+level+'&
>> filter=ancestors.id:eq:'+ancestorId+'&fields=[id,displayName]
>>
>>
>>
>> I will really appreciate your help and any link for an advanced dhis2 API
>> topic.
>>
>>
>>
>> Best,
>>
>>
>>
>> Diao
>>
>>
>>
>> --
>>
>> *DIALLO Mamadou Diao Conseiller IT, Specialiste de DHIS 2 ( District
>> Health Information Software )*
>>
>> *[image:
>> https://www.measureevaluation.org/++theme++wink-measure/images/meval_logo.png]*
>>  *[image: http://jsi.com/Managed/Images/Common/JSI_WebHeader.png]*
>>
>> *Projet de Renforcement du Système d'Information Sanitaire en Guinée*
>>
>> *Phone : 623909413 | 662256106*
>>
>> *Skype : diawwdiallo*
>>
>> www.jsi.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
>>
>>
>>
>> _______________________________________________
>> 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
>



-- 
*DIALLO Mamadou Diao Conseiller IT, Specialiste de DHIS 2 **( District
Health Information Software )*


*Projet de Renforcement du Système d'Information Sanitaire en Guinée*
*Phone : 623909413 | 662256106*
*Skype : diawwdiallo*
www.jsi.com

PNG image


References