← Back to team overview

dhis2-devs-core team mailing list archive

Re: Change from OR to AND in object filter queries

 

Hey Morten,
Why [] in the filter, why not just plain

?filter=id:in:1,2,3
?filter=name:in:John,Marie

Concerning or with two different operators, you could probably introduce OR
filter that overrides default AND logic, something like these:

*type=int OR numberType=number*
?filter=type:eq:int&filterOr=numberType:eq:number

*type=int AND numberType=number*
?filter=type:eq:int&filter=numberType:eq:number

*type=int OR numberType in (number,int)*
?filter=type:eq:int&filterOr=numberType:in:number,int

*type=int AND numberType in (number,int)*
?filter=type:eq:int&filter=numberType:in:number,int


On Wed, Jun 3, 2015 at 12:14 PM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
wrote:

> Hi
>
> The [] syntax for now is only for the IN operator (which supports a list
> of values), I could see it working for like etc also, but then what would
> we do if we want an OR but with two different operators?
>
> --
> Morten
>
> On Wed, Jun 3, 2015 at 4:07 PM, Mark Polak <markpo@xxxxxxxxxx> wrote:
>
>>  Hey All,
>>
>>  You are right Jan. It does an AND for different fields. But if you try
>> to filter on the same field it will do an OR.
>>
>>  This behaviour is a bit confusing, that one is OR and the other is AND.
>> For that reason alone i like the new syntax of introducing a different OR
>> for the same fields.
>>
>>  ?filter=id:in[1,2]
>>
>>  One thing that comes to mind, how would i use a LIKE when doing an OR?
>>  ( i don't have an immediate need for this i think though :))
>>
>>  would i be able to do something like
>>
>>  ?filter=name:like[John,Marie]
>>
>>  Regards,
>>
>>  Mark
>>
>>  On 3 Jun 2015, at 10:08, Jan Henrik Øverland <
>> janhenrik.overland@xxxxxxxxx> wrote:
>>
>>
>> https://apps.dhis2.org/demo/api/dataElements.json?paging=false&filter=dataElementGroups.id:eq:qfxEYY9xAl6&filter=name:like:dose
>>
>>
>>
>
> --
> Mailing list: https://launchpad.net/~dhis2-devs-core
> Post to     : dhis2-devs-core@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs-core
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
*Full name: *John Francis Mukulu
*Mobile Phone:* +255717154006
*Website:* http://mukulu.tk/
*Social Coding:* http://github.com/mukulu https://bitbucket.org/mukulu
*Open source developer*

References