Event filter does not work for Element linked to Option Set

We have an Event program, which has an Element named ‘Transaction Type’. The Element is linked with an Option Set of 6 options - the Id is numeric and the value is text. Data entry and display in Capture app works OK. When we try to FILTER the data in Capture app by the ‘Transaction Type’ field - it throws -

An unexpected error has occurred. Please contact your system administrator

and does not filter. Even we tried the same with Events API -

https://*****/api/36/events.json?ou=vQuQawxSYbc&program=pYGIlffbGeL&startDate=2024-03-01&endDate=2024-03-31&fields=dataValues[dataElement,value]&filter=B3YQBt31Fst:EQ:4

The last field B3YQBt31Fst:EQ:4 is the one what we are trying to achieve - ‘give me the events of a org unit between certain dates where transaction type is 4’. But, this does not work. Filter with other fields (which are not against option set works OK).

Anyone faced the same issue before?

Hi @Mahmud

It appears that you are using a deprecated endpoint. As noted in the documentation,

GET/POST/PUT/DELETE /api/events is a deprecated endpoint, so it’d be great if you could test the /api/tracker/events endpoint instead. Please read further in the DHIS2 Developer docs: Tracker - DHIS2 Documentation

Thanks!

We are using 2.36.3, and when I run https://*****/api/36/tracker/events - that returns that endpoint does not exist.

Good to know that it is a deprecated API and we would start exploring the new one, the question mainly was - filter with ‘option set linked element’ does not work. We removed the option set from the element - and we are seeing that the filter is working OK. So it seems it’s a bug.

1 Like