My Products
Help
Véronique
CONTRIBUTOR **

Orderby query parameter

by Véronique

Hello,

 

We would like to be able to order the results by a certain field for endpoints /customer, /supplier and /contact. The orderBy query parameter, when it exists, doesn't seem to have any effect on the order of the returned items.

 

This would help solving the issue we currently have. Our scenario (using contact as an example, same scenario for other entities): we need to fetch all the contacts that were modified after a certain date and process them. During the process, we might update the contacts.

We actually fetch the contacts and process them page by page, with a page size of 25. In other words: fetch 25 contacts, update them, fetch next 25 contacts, update them and so on.

The problem is that when using the lastModifiedDateTime query parameter, the results are automatically ordered by the lastModifiedDateTime field. Since we update the 25 first contacts after we fetched them, their lastModifiedDateTime changes and these contacts are no longer the 25 first contacts. When fetching the second page of 25 contacts, the order has changed and we miss some contacts and process other contacts twice.

If we could order the contacts by another field then the order would not change and we would be able to process all the contacts.

Our workaround is to fetch all the contacts before processing them, but it means that all the contacts are loaded in memory, which is not ideal.

 

Do you have any plan to implement the orderby query parameter for these endpoints?

 

Thank you

4 REPLIES 4

by Yıldırım (Updated ‎03-09-2020 14:52 by Yıldırım VISMA )

Hello, 

Currently, OrderBy query parameter is obsolete and it's omitted by the endpoints. Every transaction is automatically ordered by ASC based on its PK while being fetched from the DB (base GET invoke),therefore, it shouldn't be used in the URI. This parameter will be removed from the API documentation soon. 

If you could register this request at Ideas section, this will be evaluated by the development team.
Thanks.

Véronique
CONTRIBUTOR **

by Véronique

Actually it would be perfect for our scenario if the results were always ordered by the PK, unfortunately it's not the case when using the lastModifiedDateTime query parameter. With this parameter, the results are ordered by lastModifiedDateTime.

Is this a bug then?

by Yıldırım

Hello Véronique,
We'll check this over to make sure whether it's working as designed. (LastModifiedDate & Default Sort-Ordering)

Accepted solution
Yıldırım
VISMA

by Yıldırım (Updated ‎03-09-2020 16:16 by Yıldırım VISMA )

We confirm that this is currently following the intended behaviour, results are ordered by LastModifiedDateTime when LMDT is used as filtering parameter. In base GET calls, records are orderedBy "internalId". 

 
We definitely understand the bottleneck you're experiencing so if you could make a change/adjustment request at the Ideas section, we'll check that if this behaviour in the specification can be modified as you described.