web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to use substr function in order by clause in X++

(0) ShareShare
ReportReport
Posted on by

How can I achieve the  following in X++

while select TaxTrans_IN

order by substr(TaxTrans_IN.WAREHOUSE,1,2), TaxTrans_IN.TransDate

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Faisal Fareed Profile Picture
    10,796 User Group Leader on at

    Hi Ravi,

    You cannot use functions in select statements in AX its not supported. You can either use computed columns in a view or call direct SQL query (e.g. through Statement class in AX or a framework in .NET, such as Entity Framework).

  • Verified answer
    Vilmos Kintera Profile Picture
    46,149 on at

    You cannot use such functions in an AX select statement, it has no interpreter for AX functionality to be executed on SQL Server-side.

    But if you want to sort it by the first 2 characters anyway, it would be correctly sorted if you just order by the warehouse, since it will be in alphanumerical order anyway!

  • Community Member Profile Picture
    on at

    Thanks

  • Verified answer
    Faisal Fareed Profile Picture
    10,796 User Group Leader on at

    Hi Ravi,

    If our suggestions helped you please mark this question as verified to help our members

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans