← Back to team overview

dhis2-devs team mailing list archive

Re: [Dhis2-users] Recursive filters not working in the DHIS2 web API

 

Hi Morten,

Thanks for the prompt response, I understood the OR query.  But I don’t want an OR operation, I want the dataElementGroup which has both the Des as members.
How to achieve that?

As per the documentation the query the sent should give me groups which have both the ID1 & ID2 dataelements as members, right?

Regards,
GAURAV


From: Morten Olav Hansen [mailto:morten@xxxxxxxxx]
Sent: Thursday, July 06, 2017 8:05 PM
To: Gaurav Kumar <gkumar@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Cc: dhis2-devs@xxxxxxxxxxxxxxxxxxx; dhis2-users@xxxxxxxxxxxxxxxxxxx; Lars Helge Øverland <larshelge@xxxxxxxxx>
Subject: Re: [Dhis2-users] Recursive filters not working in the DHIS2 web API

Hi Gaurav

This was change quite some time back. The default filter operator is now AND, which means that query will not work. You have 2 options:

https:/serverurl.org/api/26/dataElementGroups.json?filter=dataElements.id:in:[ID1,ID2]<http://serverurl.org/api/26/dataElementGroups.json?filter=dataElements.id:in:%5bID1,ID2%5d>

or

https:/serverurl.org/api/26/dataElementGroups.json?filter=dataElements.id:eq:ID1&filter=dataElements.id:eq:ID2&rootJunction=OR<http://serverurl.org/api/26/dataElementGroups.json?filter=dataElements.id:eq:ID1&filter=dataElements.id:eq:ID2&rootJunction=OR>

https://docs.dhis2.org/master/en/developer/html/webapi_metadata_object_filter.html
https://docs.dhis2.org/master/en/developer/html/webapi_metadata_object_filter.html#webapi_metadata_logical_operator


--
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org

On Thu, Jul 6, 2017 at 8:52 PM, Gaurav Kumar <gkumar@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx<mailto:gkumar@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>> wrote:
Hi Devs,

We recently upgraded to DHIS2.26, and I have recently found that recursive filters are no longer working in the WEB API. To make sure that this was just not our revision that has this bug, I also tested on the DHIS2 latest stable demo site and there also I saw the same behavior.

To clarify more; queries in the following format: https:/serverurl.org/api/26/dataElementGroups.json?filter=dataElements.id:eq:ID1<http://serverurl.org/api/26/dataElementGroups.json?filter=dataElements.id:eq:ID1> &filter=dataElements.id:eq:ID2 , returns an empty list though I checked and found that more than one DE-groups with the queried DEs exist. I tried this with other resources as well but encountered the same issue.

I also checked the 2.26 and 2.28 documentation to check if there has been a change in the query format but the manuals still specify that same. So I am wondering if this is a bug or the documents are not updated.

As this is affecting a critical module of ours, any prompt help will be highly appreciated.

Regards,

GAURAV
Technical Consultant
International Medical Corps

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx<mailto:dhis2-users@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp


References