cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Orderby Query in Offline Mode for Object Tables

Will3
Explorer
0 Likes
508

Hello!

I am encountering a strange issue when trying to sort the objects in my object table using the following query:
$expand=to_Result,to_ItemValues&$orderby=ItemNo&$filter=to_Result/WorkOrder eq '{MaintenanceOrder}' and to_Result/Operation eq '{MaintenanceOrderOperation}'
(I have also tried the 'orderyby' property at the end of the URL with the same result)

The order of the objects is controlled by a field in ODATA called 'ItemNo'. This is simply any number between 1 and 14. While online, the query behaves predictably and orders the objects in an arrangement starting at object #1 and ending at object #20. (1,2,3...12,13,14) (See Image #1)

However, when switching to offline mode the order changes to: 1,10,11,12,13,14,2,3,4,5,6,7,8,9 (See Image #2). I can see the logic that is being used here, and in a way it makes sense to a computer... but it is still incorrect.

Is there a way to get this to organize correctly without attempting to create an entire extension control? Is this a bug in the MDK editor itself, and how it reads number values offline?
(I have attached a copy of the section/object-table structure)

Any help would be greatly appreciated!

 

Accepted Solutions (0)

Answers (1)

Answers (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Likes

Please check your $metadata for the Asset_Manager_V2_Demo.service for the ItemNo field in the entity set.  I suspect the data type is String which when sorted will give the results you describe.  When you call your online service it is handling the sorting so it correctly comes out based on an integer sort.  You may need to change the data type of the ItemNo field in your service or possibly add another field of type Integer to get your desired results.