Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

API orderby limitations

(0) ShareShare
ReportReport
Posted on by 15

Hello,

I'm trying to query a decimal field and have it order by highest to lowest, I add the orderby=MY_FIELD desc and it works for pretty much every field except for one, it will give me results but won't order by it (desc or asc).

The field is a decimal calculated field but I've done an orderby on another calculated field in the same entity and have no issues. 

Anyone have ideas?

Thanks!-

  • LeoAlt Profile Picture
    LeoAlt 16,331 Moderator on at
    RE: API orderby limitations

    Hi Derek,

    I created same project entity like yours and same calculated field remaining_hours, with your query filter:

    ?$select=new_remaining_hours,new_name,statecode&$filter=statecode eq 0&$orderby=new_remaining_hours desc

    However, the calculated field works without issue.

    9201.png

    9202.png

    While my testing is by executing web api in browser address bar and console directly, so there is no other code with it.

    Could you try to create a new field to get substracted value from estimated hours and delivered hours to test whether the issue still exists?

    If the issue still exists, could you share me: 

    > some of your other code in your JS library 

    > or any customization such as other JS libraries or business rule or workflow on your project form 

    > and your CRM version? (Mine is 9.1.0.8226 online.)

    Just want to confirm whether there is any of possible factor that may has impact on your final result.

    Regards,

    Leo

  • Derek Ip Profile Picture
    Derek Ip 15 on at
    RE: API orderby limitations

    Hi Thank you for the response.

    here's my field.

    Field.png

    calc.png

    This is my query "ovx_projects?$select=ovx_remaining_hours,ovx_name,statecode&$filter=statecode eq 0&$orderby=ovx_remaining_hours desc"

    this is my first 5 returns.

    return.png

    It doesn't seem to matter if I do desc or asc  the order is the same with this return, it's not sorting by  ovx_remaining_hours. I've tried doing the same to another calculated field I have and I can order it based on the number of that field.

    Thank you

  • LeoAlt Profile Picture
    LeoAlt 16,331 Moderator on at
    RE: API orderby limitations

    Hi Derek,

    I created a calculated decimal number field to calculate twice of the revenue field for account entity and did not encounter your issue.

    My full criteria is below:

    $select=name,revenue,new_doublerevenue&$orderby=new_doublerevenue desc&$filter=new_doublerevenue ne null

    09161.png

    Field properties:

    09162.png

    Operation:

    09163.png

    Could you share me more details such as original fields for calculated fields and the calculated fields properties of yours?

    Regards,

    Leo

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans