← Back to team overview

dhis2-users team mailing list archive

Re: Event Report (Events) - select data items which have no value

 

Hi,

Seems we have a bug there...  please file a JIRA issue and we would address
it as soon as we can.

Otherwise, since 2.25 on we have introduced support to filter events based
on data element values. You can play around with columns of the event grid
in event capture app to see the request url sent to server. Below is an
example

https://play.dhis2.org/dev/api/28/events/query.json?orgUnit=DiszpKrYNg8&programStage=Zj7UnCAulEk&;
filter=qrur9Dvnyt5:GT:10:LT:100
&dataElement=qrur9Dvnyt5,S33cRBsnXPo,fWIAEtYVEGk,K6uUAvq500H&order=lastUpdated:desc&pageSize=50&page=1&totalPages=true

It goes by something like

*api/events/query?filter=DATAELEMENT_UID:OPERATOR:VALUE*

*api/events/query?filter=DATAELEMENT_UID:EQ:NULL*

Unfortunately, we have a bug  in handling NULL as part of the query
parameter.

--
Abyot A. Gizaw.
Senior Engineer, DHIS2
University of Oslo
http://www.dhis2.org

On Mon, Feb 5, 2018 at 10:01 PM, Martin Van Aken <martin@xxxxxxxxxxxxxxxx>
wrote:

> Ok, got it, I was missing some context. Looks an interesting way to
> actually tackle some of the "queries" I have to do for a project.
>
> Thanks a lot!
>
> Martin
>
> On Mon, Feb 5, 2018 at 9:56 PM, Aaron C White <aaroncwhite@xxxxxxxxx>
> wrote:
>
>> I just had to tackle something similar recently, so it's fresh on my
>> mind.  The functions are built in to DHIS2 (but I believe are part of the
>> JEXL library according to the docs).    You would need to create the
>> program indicator first, run analytics, and then request the program
>> indicator instead of the data element in question.  I don't think you
>> can use it to hit the analytics endpoint directly.  You can find some
>> examples and more detail here
>> <https://docs.dhis2.org/2.28/en/user/html/configure_program_indicator.html#program_indicator_functions_variables_operators>
>> .
>>
>> Aaron
>>
>>
>> --
>> Aaron C. White
>> 919.522.5585 <(919)%20522-5585>
>>
>> On Mon, Feb 5, 2018 at 3:48 PM, Martin Van Aken <martin@xxxxxxxxxxxxxxxx>
>> wrote:
>>
>>> Would not have though of that approach - your examples uses the d2 JS
>>> library? Are those "operators" usable in a analytics/events/query filter
>>> string? (tried the "aggregate" null operator, but it did not work)
>>>
>>> Thanks !
>>>
>>> Martin
>>>
>>> On Mon, Feb 5, 2018 at 6:24 PM, Aaron C White <aaroncwhite@xxxxxxxxx>
>>> wrote:
>>>
>>>> Martin,
>>>>
>>>> What if you made a program indicator with inverse logic?  Something
>>>> like "!d2:hasValue(#{your_de_uid})", since if the value is numeric
>>>> "d2:oizp(#{your_de_uid})".  d2:oizp returns 1 if the value is zero or
>>>> positive and otherwise returns 0.  I bet one of those or a combination
>>>> would solve that problem.
>>>>
>>>> Aaron
>>>>
>>>>
>>>> --
>>>> Aaron C. White
>>>> 919.522.5585 <(919)%20522-5585>
>>>>
>>>> On Mon, Feb 5, 2018 at 10:53 AM, Martin Van Aken <
>>>> martin@xxxxxxxxxxxxxxxx> wrote:
>>>>
>>>>> Hi everyone,
>>>>> We are interested to get an event report with all events where a
>>>>> specific data item has no value (ie, not 0, no value at all). We're on
>>>>> 2.26, an all the conditins available are <, <=, =, > etc.
>>>>>
>>>>> Putting "=" then an empty field does not filter anything, and in this
>>>>> case "0" is taken as a separated value than "no value".
>>>>>
>>>>> Is there any way to do this?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Martin
>>>>>
>>>>> --
>>>>> *Martin Van Aken - **Freelance Enthusiast Developer*
>>>>>
>>>>> Mobile : +32 486 899 652
>>>>>
>>>>> Follow me on Twitter : @martinvanaken
>>>>> <http://twitter.com/martinvanaken>
>>>>> Call me on Skype : vanakenm
>>>>> Hang out with me : martin@xxxxxxxxxxxxxxxx
>>>>> Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
>>>>> Company website : www.joyouscoding.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
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> *Martin Van Aken - **Freelance Enthusiast Developer*
>>>
>>> Mobile : +32 486 899 652
>>>
>>> Follow me on Twitter : @martinvanaken <http://twitter.com/martinvanaken>
>>> Call me on Skype : vanakenm
>>> Hang out with me : martin@xxxxxxxxxxxxxxxx
>>> Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
>>> Company website : www.joyouscoding.com
>>>
>>
>>
>
>
> --
> *Martin Van Aken - **Freelance Enthusiast Developer*
>
> Mobile : +32 486 899 652
>
> Follow me on Twitter : @martinvanaken <http://twitter.com/martinvanaken>
> Call me on Skype : vanakenm
> Hang out with me : martin@xxxxxxxxxxxxxxxx
> Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
> Company website : www.joyouscoding.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
>
>

Follow ups

References