Symptom
- You are expecting for the records to return in ascending or descending order in the OData API response.
- You might have (or not) used the $orderby parameter in your OData API query.
- Only records of the starting entity are returning in expected order.
Environment
- SAP SuccessFactors HCM Suite
- OData API
Reproducing the Issue
- You are running a query for any entity, EmpJob for example.
- And you are performing navigations to other entities as well.
- However, when querying, in the response the records are not returned in the expected order.
Cause
The system query option sorts the starting entity only. Child entities aren’t sorted. When using $orderby on navigation records, they are not sortable.
Resolution
This is expected behavior.
The query no matter how built, it does not guarantee the order of navigation records at a framework level, and we do not override the mentioned method to fix the order, so we can confirm that navigation records are not sortable.
If you had a response where the order was correct and then another response where it was no longer correct, it can return in correct order occasionally because the data recorded in database is occasionally in the desired order. If one of the records is modified, the position in database will be changed so you will not see the result in desired order anymore.
See Also
Keywords
ascending, descending, orderBy, records, navigation, child entity, root entity, predictable. , KBA , LOD-SF-INT-ODATA , OData API Framework , Problem