← Back to team overview

dhis2-devs team mailing list archive

Missing orderby clause in TrackedEntityInstance Ids query

 

Hi DHIS team,

We are hitting the below API to fetch TrackedEntityInstance(TEI) Ids

http://<domain>/api/25/trackedEntityInstances?eventEndDate=2018-06-03&eventStartDate=2018-03-18&fields=trackedEntityInstance&ou=a2620f76786&ouMode=DESCENDANTS&page=1&pageSize=1000&totalPages=true
<http://localhost:8080/api/25/trackedEntityInstances?eventEndDate=2018-06-03&eventStartDate=2018-03-18&fields=trackedEntityInstance&ou=a2620f71996&ouMode=DESCENDANTS&page=1&pageSize=1000&totalPages=true>

The above API call will give first 1000 TEI ids because the call is
paginated with pagesize=1000. Like that we are making calls for other pages
to fetch all the TEI Ids.

DHIS is using the below query to get the TEI ids

select distinct tei from TrackedEntityInstance tei left join
tei.trackedEntityAttributeValues where (  tei.organisationUnit.path LIKE
'/a2cf79e8g34/a1c343a3w24%') and  tei.deleted is false;

In this query we couldn't find any order by clause. Is there any chance
that few of the TEI ids which are returned in some page are going to be
repeated in another page also.
Is this query going to be executed every time for each paginated API call?

-- 
Rajeswari Gottipati
Sr Consultant
Email rajeswag@xxxxxxxxxxxxxxxx
Telephone +91 9949292931 <+91%209949292931>
[image: ThoughtWorks]
<http://www.thoughtworks.com/?utm_campaign=rajeswari-gottipati-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator>

Follow ups