[Web API] Is there a way to do AND with filters?

Hi

In the documentation it says (1.6. Meta-data object filter) :-

Get all data elements with aggregation operator “sum” and value type “int”:

/api/dataElements.json?filter=aggregationOperator:eq:sum&filter=type:eq:int

Is this really possible, can I do an AND over multiple filters? may be with another syntax if not this one…

regards

harsh

Hi,

Sorry, seems the docs are a bit out of date. It was sent out on the mailing list a while that this actually changed, all operators are now AND, it is not possible to do any kind of OR operation (but you can use :in:)

···

On Fri, Sep 4, 2015 at 2:58 PM, Harsh Atal harsh.atal@gmail.com wrote:

Hi

In the documentation it says (1.6. Meta-data object filter) :-

Get all data elements with aggregation operator “sum” and value type “int”:

/api/dataElements.json?filter=aggregationOperator:eq:sum&filter=type:eq:int

Is this really possible, can I do an AND over multiple filters? may be with another syntax if not this one…

regards

harsh


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

Thank You Morten,
Could you clarify just this one more thing please :-

What does it mean for the operator gt,lt,ge,le to be applied on a field which is of type string?

For eg what would be compared if I write api/programs?filter=validationCriteria.value:gt:4 ? And the type of validationCriteria.value is string…

Can I achieve this somehow from the API?..comparing a string as though it was an integer through the gt,lt…operators?

regards

harsh

···

On 4 September 2015 at 13:32, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi,

Sorry, seems the docs are a bit out of date. It was sent out on the mailing list a while that this actually changed, all operators are now AND, it is not possible to do any kind of OR operation (but you can use :in:)


Morten

On Fri, Sep 4, 2015 at 2:58 PM, Harsh Atal harsh.atal@gmail.com wrote:

Hi

In the documentation it says (1.6. Meta-data object filter) :-

Get all data elements with aggregation operator “sum” and value type “int”:

/api/dataElements.json?filter=aggregationOperator:eq:sum&filter=type:eq:int

Is this really possible, can I do an AND over multiple filters? may be with another syntax if not this one…

regards

harsh


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Hi Harsh

String also has a numeric value, i.e. “1” is smaller than “2”, so for those simple cases you can use it. But don’t be fooled, this is -string- comparing, not comparing integers.

···

On Fri, Sep 4, 2015 at 3:46 PM, Harsh Atal harsh.atal@gmail.com wrote:

Thank You Morten,
Could you clarify just this one more thing please :-

What does it mean for the operator gt,lt,ge,le to be applied on a field which is of type string?

For eg what would be compared if I write api/programs?filter=validationCriteria.value:gt:4 ? And the type of validationCriteria.value is string…

Can I achieve this somehow from the API?..comparing a string as though it was an integer through the gt,lt…operators?

regards

harsh


Morten

On 4 September 2015 at 13:32, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi,

Sorry, seems the docs are a bit out of date. It was sent out on the mailing list a while that this actually changed, all operators are now AND, it is not possible to do any kind of OR operation (but you can use :in:)


Morten

On Fri, Sep 4, 2015 at 2:58 PM, Harsh Atal harsh.atal@gmail.com wrote:

Hi

In the documentation it says (1.6. Meta-data object filter) :-

Get all data elements with aggregation operator “sum” and value type “int”:

/api/dataElements.json?filter=aggregationOperator:eq:sum&filter=type:eq:int

Is this really possible, can I do an AND over multiple filters? may be with another syntax if not this one…

regards

harsh


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp